Skip to content

V6 merge master #1191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 31 commits into from
Feb 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
8fd9809
Add customLoader and remove animatable (#1152)
lidord-wix Feb 3, 2021
fae574f
Fix/responsive docs pages (#1174)
ethanshar Feb 4, 2021
5a84e93
Fix/tab controller center android with rtl (#1178)
M-i-k-e-l Feb 4, 2021
f882bb5
Update generate types
ethanshar Feb 5, 2021
89ed846
Update uilib-docs version to 1.0.11
ethanshar Feb 5, 2021
e8dc2a0
Fix order of markdown pages in docs site
ethanshar Feb 5, 2021
b3824e3
Fix issue with duplicate props appearing in docs site
ethanshar Feb 6, 2021
1c32997
Fix issue with Carousel props not being included in docs
ethanshar Feb 6, 2021
4c39ff0
Update PageControl docs with a gif
ethanshar Feb 6, 2021
2ab5545
Fix and improve search using fuzzysearch
ethanshar Feb 6, 2021
d553e35
Update Carousel gifs
ethanshar Feb 6, 2021
433ebef
Fix Carousel gif
ethanshar Feb 6, 2021
fe7b396
Add vertical scroll to Carousel component (#1175)
kochavi-daniel Feb 7, 2021
e4b582b
Remove addItems from screen with fewItems
M-i-k-e-l Feb 7, 2021
45e07e9
Feat/image demo broken (#1173)
Inbal-Tish Feb 8, 2021
225f98f
no-direct-import eslint rule - adding `applyAutofix` flag (#1183)
Inbal-Tish Feb 9, 2021
aa87e5a
updating published version
Inbal-Tish Feb 9, 2021
22a4dd6
Fix Carousel typings
ethanshar Feb 10, 2021
eb0954d
Avoid passing overlayContent in CardSecion (#1187)
ethanshar Feb 10, 2021
ccb4282
Disable flipper
ethanshar Feb 12, 2021
55cb8ed
Export TabBarProps and fix BadgeScreen typescript errors
M-i-k-e-l Feb 14, 2021
104e999
Update expo snack link with only supported platforms
ethanshar Feb 15, 2021
e3eb3dd
Update our stars count
ethanshar Feb 15, 2021
af976f0
Safe require blur-view dependency in Card (#1179)
ethanshar Feb 15, 2021
79e8e37
Infra/expo app fixes (#1166)
ethanshar Feb 15, 2021
f5bbad7
prop value shape deprecation lint rule (#1094)
lidord-wix Feb 16, 2021
c44a30a
fix: catch undefined StatusBarManager (#1189)
jaulz Feb 17, 2021
560cfda
Update generate types
ethanshar Feb 17, 2021
e655b64
replace @react-native-community/picker with @react-native-picker/pick…
ethanshar Feb 17, 2021
db258d5
Button - refactor into smaller files (#1168)
M-i-k-e-l Feb 17, 2021
7ad05bb
Merge branch 'master' into v6-merge-master
M-i-k-e-l Feb 17, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions demo/src/configurations.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,18 @@ import {Assets, Typography, Spacings} from 'react-native-ui-lib'; // eslint-disa

Assets.loadAssetsGroup('icons.demo', {
add: require('./assets/icons/add.png'),
camera: require('./assets/icons/cameraSelected.png'),
close: require('./assets/icons/close.png'),
dashboard: require('./assets/icons/dashboard.png'),
image: require('./assets/icons/image.png'),
refresh: require('./assets/icons/refresh.png'),
search: require('./assets/icons/search.png')
});

Assets.loadAssetsGroup('images.demo', {
brokenImage: require('./assets/images/placeholderMissingImage.png')
});

Typography.loadTypographies({
h1: {...Typography.text40},
h2: {...Typography.text50},
Expand Down
10 changes: 10 additions & 0 deletions demo/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ module.exports = {
get CarouselScreen() {
return require('./screens/componentScreens/CarouselScreen').default;
},
get CarouselVerticalScreen() {
return require('./screens/componentScreens/CarouselVerticalScreen').default;
},
get CheckboxScreen() {
return require('./screens/componentScreens/CheckboxScreen').default;
},
get ChipScreen() {
return require('./screens/componentScreens/ChipScreen').default;
},
get ConnectionStatusBarScreen() {
return require('./screens/componentScreens/ConnectionStatusBarScreen').default;
},
Expand Down Expand Up @@ -203,6 +209,10 @@ module.exports = {
get ProgressBarScreen() {
return require('./screens/componentScreens/ProgressBarScreen').default;
},
// Incubator
get IncubatorTextFieldScreen() {
return require('./screens/incubatorScreens/IncubatorTextFieldScreen').default;
},
// realExamples
get AppleMusic() {
return require('./screens/realExamples/AppleMusic').default;
Expand Down
1 change: 1 addition & 0 deletions demo/src/screens/MenuStructure.js
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ export const navigationData = {
title: 'Layouts & Templates',
screens: [
{title: 'Carousel', tags: 'carousel', screen: 'unicorn.components.CarouselScreen'},
{title: 'Carousel (Vertical)', tags: 'carousel', screen: 'unicorn.components.CarouselVerticalScreen'},
{title: 'LoadingScreen', tags: 'loading screen', screen: 'unicorn.screens.LoadingScreen'},
{title: 'Modal', tags: 'modal topbar screen', screen: 'unicorn.screens.ModalScreen'},
{title: 'StateScreen', tags: 'empty state screen', screen: 'unicorn.screens.EmptyStateScreen'},
Expand Down
15 changes: 5 additions & 10 deletions demo/src/screens/componentScreens/BadgesScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,11 @@ const star = require('../../assets/icons/star.png');
const bell = require('../../assets/icons/bell.png');

export default class BadgesScreen extends Component {
constructor(props) {
super(props);
state = {
value: 42
};

this.state = {
value: 42
};
}

changeLabelValue(value) {
changeLabelValue(value: number) {
const currValue = this.state.value;
const newValue = currValue + value;
if (newValue >= 1) {
Expand Down Expand Up @@ -103,7 +99,6 @@ export default class BadgesScreen extends Component {
<View row>
<View
center
column
style={{justifyContent: 'space-around', alignItems: 'flex-start', width: 140, height: 140}}
>
<Text text80 row>
Expand All @@ -115,7 +110,7 @@ export default class BadgesScreen extends Component {
</Text>
</View>

<View center column style={{justifyContent: 'space-around', width: 40, height: 140}}>
<View center style={{justifyContent: 'space-around', width: 40, height: 140}}>
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.green30} size={6}/>
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.red30} size={10}/>
<Badge containerStyle={{marginLeft: BadgesSpace}} backgroundColor={Colors.blue30} size={14}/>
Expand Down
109 changes: 109 additions & 0 deletions demo/src/screens/componentScreens/CarouselVerticalScreen.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,109 @@
import {Carousel, Constants, Text, View, Colors} from 'react-native-ui-lib';
import React, {Component} from 'react';
import _ from 'lodash';
import {StyleSheet} from 'react-native';
import {
renderBooleanOption,
renderSliderOption
} from '../ExampleScreenPresenter';

interface Props {}

interface State {
numberOfPagesShown: number;
autoplay: boolean;
}

const BACKGROUND_COLORS = [
Colors.red50,
Colors.yellow20,
Colors.purple50,
Colors.green50,
Colors.cyan50,
Colors.purple20,
Colors.blue60,
Colors.red10,
Colors.green20,
Colors.purple60
];

const pageHeight = Constants.windowHeight / 2;

class CarouselVerticalScreen extends Component<Props, State> {
carousel = React.createRef<typeof Carousel>();

constructor(props: Props) {
super(props);

this.state = {
numberOfPagesShown: 5,
autoplay: false
};
}

render() {
const {numberOfPagesShown, autoplay} = this.state
return (
<View flex paddingT-20>
<View marginH-20 marginB-20>
{renderBooleanOption.call(this, 'autoplay', 'autoplay')}
{renderSliderOption.call(
this,
'Number of pages shown',
'numberOfPagesShown',
{
min: 3,
max: 10,
step: 1,
initial: 5
}
)}
</View>
<Carousel
key={'carousel'}
ref={this.carousel}
autoplay={autoplay}
pageWidth={Constants.windowWidth}
pageHeight={pageHeight}
initialPage={0}
containerStyle={{height: pageHeight}}
allowAccessibleLayout
horizontal={false}
>
{_.map([...Array(numberOfPagesShown)], (_, index) => (
<Page
style={{backgroundColor: BACKGROUND_COLORS[index]}}
key={index}
>
<Text style={styles.pageText}>{index}</Text>
</Page>
))}
</Carousel>
</View>
);
}
}

// @ts-ignore
const Page = ({children, style, ...others}) => {
return (
<View center {...others} style={[styles.page, style]}>
{children}
</View>
);
};

const styles = StyleSheet.create({
container: {},
page: {
flex: 1,
height: pageHeight,
width: Constants.windowWidth
},
pageText: {
fontSize: 40,
color: 'white'
}
});

export default CarouselVerticalScreen
19 changes: 11 additions & 8 deletions demo/src/screens/componentScreens/ImageScreen.tsx
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
import React, {Component} from 'react';
import {View, Text, Image, Colors} from 'react-native-ui-lib';
import {View, Text, Image, Colors, Assets} from 'react-native-ui-lib';
import {renderBooleanOption, renderRadioGroup, renderSliderOption} from '../ExampleScreenPresenter';

import cameraIcon from '../../assets/icons/cameraSelected.png';

const IMAGE_URL =
'https://images.pexels.com/photos/748837/pexels-photo-748837.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260';

const BROKEN_URL = 'file:///Desktop/website/img/cupcake.jpg';
const DEFAULT_SIZE = 100;

class ImageScreen extends Component {
state = {
cover: true,
showOverlayContent: false,
overlayType: 'none',
margin: 0
margin: 0,
showErrorImage: false
};

renderOverlayContent() {
Expand All @@ -25,7 +26,7 @@ class ImageScreen extends Component {
<View row centerV>
<Image
style={{margin: 5, marginRight: 10}}
source={cameraIcon}
source={Assets.icons.demo.camera}
tintColor={overlayType !== 'none' ? Colors.white : undefined}
/>
<Text text30 white={overlayType !== 'none'}>
Expand All @@ -35,19 +36,20 @@ class ImageScreen extends Component {
</View>
);
} else {
return <Image style={{margin: 5}} source={cameraIcon}/>;
return <Image style={{margin: 5}} source={Assets.icons.demo.camera}/>;
}
}
}

render() {
const {cover, overlayType, margin} = this.state;
const {cover, overlayType, margin, showErrorImage} = this.state;

return (
<View flex>
<View centerH height={250}>
<Image
source={{uri: IMAGE_URL}}
source={{uri: showErrorImage ? BROKEN_URL : IMAGE_URL}}
errorSource={Assets.images.demo.brokenImage}
cover={cover}
overlayType={overlayType !== 'none' ? overlayType : undefined}
style={!cover && {width: DEFAULT_SIZE, height: DEFAULT_SIZE}}
Expand All @@ -61,6 +63,7 @@ class ImageScreen extends Component {
<View flex>
{renderBooleanOption.call(this, 'Show as Cover Image', 'cover')}
{renderBooleanOption.call(this, 'Show Overlay Content', 'showOverlayContent')}
{renderBooleanOption.call(this, 'Show Error Image', 'showErrorImage')}
{renderRadioGroup.call(this, 'Overlay Type', 'overlayType', {none: 'none', ...Image.overlayTypes})}
{renderSliderOption.call(this, 'Margin(margin-XX)', 'margin', {step: 4, min: 0, max: 40})}
</View>
Expand Down
30 changes: 6 additions & 24 deletions demo/src/screens/componentScreens/LoadingScreen.js
Original file line number Diff line number Diff line change
@@ -1,40 +1,22 @@
import React, {Component} from 'react';
import {View as AnimatableView} from 'react-native-animatable';
import {View, Text, LoaderScreen, Colors} from 'react-native-ui-lib';//eslint-disable-line

import {View, Text, LoaderScreen, Colors} from 'react-native-ui-lib';
export default class LoadingScreen extends Component {

state = {
loading: true,
loading: true
};

componentDidMount() {
setTimeout(() => {
this.setState({
animationConfig: {
animation: 'fadeOut',
onAnimationEnd: () => this.setState({loading: false}),
},
});
this.setState({loading: false});
}, 2500);
}

render() {
const {loading, animationConfig} = this.state;
const {loading} = this.state;
return (
<View flex bg-orange70 center>
<Text text10>
Content Content Content
</Text>
{loading &&
<AnimatableView {...animationConfig}>
<LoaderScreen
color={Colors.blue30}
message="Loading..."
overlay
/>
</AnimatableView>
}
<Text text10>Content Content Content</Text>
{loading && <LoaderScreen color={Colors.blue30} message="Loading..." overlay/>}
</View>
);
}
Expand Down
1 change: 1 addition & 0 deletions demo/src/screens/componentScreens/PickerScreen.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ export default class PickerScreen extends Component {
placeholder="Favorite Language"
floatingPlaceholder
value={this.state.language}
enableModalBlur={false}
onChange={item => this.setState({language: item})}
topBarProps={{title: 'Languages'}}
style={{color: Colors.red20}}
Expand Down
1 change: 1 addition & 0 deletions demo/src/screens/componentScreens/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ export function registerScreens(registrar) {
registrar('unicorn.components.CardsScreen', () => require('./CardsScreen').default);
registrar('unicorn.animations.CardScannerScreen', () => require('../componentScreens/CardScannerScreen').default);
registrar('unicorn.components.CarouselScreen', () => require('./CarouselScreen').default);
registrar('unicorn.components.CarouselVerticalScreen', () => require('./CarouselVerticalScreen').default);
registrar('unicorn.components.CheckboxScreen', () => require('./CheckboxScreen').default);
registrar('unicorn.components.ChipScreen', () => require('./ChipScreen').default);
registrar('unicorn.components.ConnectionStatusBar', () => require('./ConnectionStatusBarScreen').default);
Expand Down
17 changes: 11 additions & 6 deletions eslint-rules/lib/rules/no-direct-import.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,16 @@ const MAP_SCHEMA = {
type: 'object',
properties: {
origin: {
type: 'string',
type: 'string'
},
destination: {
type: 'string',
type: 'string'
},
applyAutofix: {
type: 'boolean'
}
},
additionalProperties: false,
additionalProperties: false
};

module.exports = {
Expand All @@ -19,7 +22,7 @@ module.exports = {
recommended: true,
},
messages: {
uiLib: 'Do not import directly from this source. Please use another import source (autofix available).',
uiLib: 'Do not import directly from this source. Please use another import source (autofix may be available).',
},
fixable: 'code',
schema: [
Expand All @@ -31,12 +34,14 @@ module.exports = {
try {
const origin = context.options[0].origin;
const destination = context.options[0].destination;
const message = `Do not import directly from '${origin}'. Please use '${destination}' (autofix available).`;
const applyAutofix = context.options[0].applyAutofix;
const autofixMessage = applyAutofix ? ' (autofix available)' : '';
const message = `Do not import directly from '${origin}'. Please use '${destination}'${autofixMessage}.`;
context.report({
node,
message,
fix(fixer) {
if (node && destination) {
if (node && applyAutofix && destination) {
return fixer.replaceText(node.source, `'${destination}'`);
}
},
Expand Down
Loading