Skip to content

Commit b8661bf

Browse files
committed
Merge branch 'master' into release
2 parents cd53141 + 0f067e8 commit b8661bf

File tree

13 files changed

+141
-47
lines changed

13 files changed

+141
-47
lines changed

README.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -19,8 +19,10 @@ Check out our [Docs](https://wix.github.io/react-native-ui-lib/). <br>
1919
Our [Discord Channel](https://discord.gg/2eW4g6Z)
2020

2121
Download our Expo demo app <br>
22-
<img height="120" src="https://user-images.githubusercontent.com/1780255/76164023-f2171400-6153-11ea-962d-d57b64a08a80.png"> <br>
22+
<img height="120" src="https://qr.expo.dev/expo-go?owner=vn.chemgio&slug=rnuilib&releaseChannel=default&host=exp.host"> <br>
2323
(You will need the Expo App)
24+
or open link in your devices
25+
[expo ] [exp://exp.host/@vn.chemgio/rnuilib?release-channel=default](exp://exp.host/@vn.chemgio/rnuilib?release-channel=default)
2426

2527
## Installing
2628

demo/package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
"demoRelease": "node ./scripts/demoRelease.js"
1717
},
1818
"devDependencies": {
19-
"react-native-ui-lib": "*",
19+
"react-native-ui-lib": "7.1.0",
2020
"shell-utils": "^1.0.10"
2121
},
2222
"peerDependencies": {

demo/src/index.js

+57
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,9 @@ module.exports = {
198198
get ColorsScreen() {
199199
return require('./screens/foundationScreens/ColorsScreen').default;
200200
},
201+
get DarkMode() {
202+
return require('./screens/foundationScreens/DarkModeScreen').default;
203+
},
201204
get TypographyScreen() {
202205
return require('./screens/foundationScreens/TypographyScreen').default;
203206
},
@@ -214,10 +217,40 @@ module.exports = {
214217
get ProgressBarScreen() {
215218
return require('./screens/componentScreens/ProgressBarScreen').default;
216219
},
220+
get ScrollBar() {
221+
return require('./screens/componentScreens/ScrollBarScreen').default;
222+
},
223+
get Marquee() {
224+
return require('./screens/componentScreens/MarqueeScreen').default;
225+
},
226+
get NumberInput() {
227+
return require('./screens/componentScreens/NumberInputScreen').default;
228+
},
229+
get WheelPicker() {
230+
return require('./screens/componentScreens/WheelPickerScreen').default;
231+
},
232+
get GridList() {
233+
return require('./screens/componentScreens/GridListScreen').default;
234+
},
235+
get SortableGridList() {
236+
return require('./screens/componentScreens/SortableGridListScreen').default;
237+
},
217238
// Incubator
218239
get PanViewScreen() {
219240
return require('./screens/incubatorScreens/PanViewScreen').default;
220241
},
242+
get IncubatorSlider() {
243+
return require('./screens/incubatorScreens/IncubatorSliderScreen').default;
244+
},
245+
get IncubatorDialog() {
246+
return require('./screens/incubatorScreens/IncubatorDialogScreen').default;
247+
},
248+
get IncubatorToast() {
249+
return require('./screens/incubatorScreens/IncubatorToastScreen').default;
250+
},
251+
get IncubatorExpandableOverlay() {
252+
return require('./screens/incubatorScreens/IncubatorExpandableOverlayScreen').default;
253+
},
221254
// realExamples
222255
get AppleMusic() {
223256
return require('./screens/realExamples/AppleMusic').default;
@@ -237,6 +270,30 @@ module.exports = {
237270
// wrapperScreens
238271
get TouchableOpacityScreen() {
239272
return require('./screens/componentScreens/TouchableOpacityScreen').default;
273+
},
274+
get Modal() {
275+
return require('./screens/componentScreens/ModalScreen').default;
276+
},
277+
get Timeline() {
278+
return require('./screens/componentScreens/TimelineScreen').default;
279+
},
280+
get WithScrollEnabler() {
281+
return require('./screens/componentScreens/WithScrollEnablerScreen').default;
282+
},
283+
get WithScrollReached() {
284+
return require('./screens/componentScreens/WithScrollReachedScreen').default;
285+
},
286+
get Fader() {
287+
return require('./screens/componentScreens/FaderScreen').default;
288+
},
289+
get GridView() {
290+
return require('./screens/componentScreens/GridViewScreen').default;
291+
},
292+
get Playground() {
293+
return require('./screens/PlaygroundScreen').default;
294+
},
295+
get KeyboardAwareScrollView() {
296+
return require('./screens/componentScreens/KeyboardAwareScrollViewScreen').default;
240297
}
241298
};
242299
},

demo/src/screens/incubatorScreens/IncubatorSliderScreen.tsx

+3-4
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ import {renderBooleanOption} from '../ExampleScreenPresenter';
66
const VALUE = 20;
77
const NEGATIVE_VALUE = -30;
88
const MIN = 0;
9-
const MAX = 100;
10-
const INITIAL_MIN = 10;
11-
const INITIAL_MAX = 70;
9+
const MAX = Constants.screenWidth - 40; // horizontal margins 20
10+
const INITIAL_MIN = 30;
11+
const INITIAL_MAX = 270;
1212

1313
const IncubatorSliderScreen = () => {
1414
const [disableRTL, setDisableRTL] = useState<boolean>(false);
@@ -161,7 +161,6 @@ const IncubatorSliderScreen = () => {
161161
<Incubator.Slider
162162
ref={rangeSlider}
163163
useRange
164-
useGap
165164
onRangeChange={onRangeChange}
166165
minimumValue={MIN}
167166
maximumValue={MAX}

demo/src/screens/realExamples/ProductPage/index.tsx

+2-3
Original file line numberDiff line numberDiff line change
@@ -77,13 +77,12 @@ class Product extends Component {
7777
migrate
7878
value={selectedColor}
7979
onChange={(value: string) => this.setState({selectedColor: value})}
80-
rightIconSource={{}}
81-
rightIconStyle={{
80+
trailingAccessory={<Icon {...{
8281
width: 24,
8382
height: 24,
8483
backgroundColor: colorOptions[selectedColor].color,
8584
borderRadius: 12
86-
}}
85+
}} />}
8786
>
8887
{_.map(colorOptions, (colorOption, colorKey) => {
8988
return <Picker.Item key={colorKey} value={colorKey} label={colorOption.name}/>;

docs/foundation/colors.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ All the design tokens and their mapping in light mode can be found [here](https:
4949
Adding or overriding your own design tokens can be done by using the [loadSchemes](https://wix.github.io/react-native-ui-lib/docs/foundation/colors#loadschemes) method.
5050
To generate the design tokens, based on your app primary color and load them automatically into the `Colors` object, use:
5151
```javascript
52-
Colros.loadDesignTokens({primaryColor: <your primary color>});
52+
Colors.loadDesignTokens({primaryColor: <your primary color>});
5353
```
5454
This method will update all the `primary` tokens to be based on your app primary color, both in light and dark mode.
5555

expoDemo/app.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"privacy": "public",
88
"description": "Demo project show case for react-native-ui-lib components",
99
"githubUrl": "https://github.com/wix/react-native-ui-lib",
10-
"version": "2.0.0",
10+
"version": "7.1.0",
1111
"orientation": "portrait",
1212
"icon": "https://user-images.githubusercontent.com/1780255/107911939-34e98a80-6f66-11eb-91a6-1eb1b384e429.png",
1313
"splash": {

expoDemo/metro.config.js

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
const {getDefaultConfig} = require('@expo/metro-config');
2+
3+
/**
4+
* Metro configuration for React Native
5+
* https://github.com/facebook/react-native
6+
*
7+
* @format
8+
*/
9+
module.exports = (async () => {
10+
const {
11+
resolver: {sourceExts, assetExts}
12+
} = await getDefaultConfig(__dirname);
13+
return {
14+
transformer: {
15+
getTransformOptions: async () => ({
16+
transform: {
17+
experimentalImportSupport: false,
18+
inlineRequires: false
19+
}
20+
}),
21+
babelTransformerPath: require.resolve('react-native-svg-transformer')
22+
},
23+
resolver: {
24+
assetExts: assetExts.filter(ext => ext !== 'svg'),
25+
sourceExts: [...sourceExts, 'svg']
26+
}
27+
};
28+
})();

expoDemo/package.json

+26-22
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
{
2-
"main": "node_modules/expo/AppEntry.js",
32
"scripts": {
43
"start": "expo start",
54
"android": "expo start --android",
@@ -8,30 +7,35 @@
87
"eject": "expo eject"
98
},
109
"dependencies": {
11-
"@react-native/normalize-color": "^2.0.0",
12-
"@react-navigation/native": "^6.0.13",
13-
"@react-navigation/stack": "^6.0.13",
14-
"expo": "^46.0.0",
15-
"expo-status-bar": "~1.4.0",
10+
"@expo/metro-config": "^0.7.1",
11+
"@react-native/normalize-color": "^2.1.0",
12+
"@react-navigation/native": "^6.1.5",
13+
"@react-navigation/stack": "^6.3.15",
14+
"expo": "^48.0.4",
15+
"expo-status-bar": "~1.4.4",
1616
"fuzzysearch": "^1.0.3",
1717
"lodash": "^4.17.21",
18-
"react": "18.0.0",
19-
"react-dom": "18.0.0",
20-
"react-native": "0.69.6",
21-
"react-native-gesture-handler": "~2.5.0",
22-
"react-native-reanimated": "~2.9.1",
23-
"react-native-safe-area-context": "4.3.1",
24-
"react-native-screens": "~3.15.0",
25-
"react-native-svg": "12.3.0",
26-
"react-native-ui-lib": "snapshot",
27-
"react-native-web": "~0.18.7",
28-
"unicorn-demo-app": "snapshot"
29-
},
18+
"metro-config": "^0.75.1",
19+
"react": "18.2.0",
20+
"react-dom": "18.2.0",
21+
"react-native": "0.71.3",
22+
"react-native-gesture-handler": "~2.9.0",
23+
"react-native-haptic-feedback": "^1.14.0",
24+
"react-native-navigation": "^7.32.1",
25+
"react-native-reanimated": "~2.14.4",
26+
"react-native-safe-area-context": "4.5.0",
27+
"react-native-screens": "~3.20.0",
28+
"react-native-svg": "13.4.0",
29+
"react-native-svg-transformer": "^1.0.0",
30+
"react-native-ui-lib": "^7.1.0",
31+
"react-native-web": "~0.18.12",
32+
"unicorn-demo-app": "^7.1.0"
33+
},
3034
"devDependencies": {
31-
"@babel/core": "^7.18.6",
32-
"@types/react": "~18.0.0",
33-
"@types/react-native": "~0.69.1",
34-
"typescript": "^4.6.3"
35+
"@babel/core": "^7.21.0",
36+
"@types/react": "~18.0.28",
37+
"@types/react-native": "~0.71.3",
38+
"typescript": "^4.9.5"
3539
},
3640
"private": true
3741
}

src/components/skeletonView/index.tsx

+3-3
Original file line numberDiff line numberDiff line change
@@ -324,12 +324,12 @@ class SkeletonView extends Component<SkeletonViewProps, SkeletonState> {
324324
};
325325

326326
renderAdvanced = () => {
327-
const {children, renderContent, showContent, style, ...others} = this.props;
327+
const {children, renderContent, showContent, style, testID, ...others} = this.props;
328328
const data = showContent && _.isFunction(renderContent) ? renderContent(this.props) : children;
329329

330330
return (
331-
<View style={style} {...this.contentAccessibilityProps} {...others}>
332-
<ShimmerPlaceholder {...this.getDefaultSkeletonProps()} {...others}>
331+
<View style={style} {...this.contentAccessibilityProps} testID={testID} {...others}>
332+
<ShimmerPlaceholder {...this.getDefaultSkeletonProps()} testID={`${testID}.shimmer`} {...others}>
333333
{showContent && data}
334334
</ShimmerPlaceholder>
335335
</View>

src/incubator/Slider/Thumb.tsx

+11-7
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ export interface Props extends ViewProps {
2323
shouldBounceToStep: boolean;
2424
stepInterpolatedValue: SharedValue<number>;
2525
gap?: number;
26+
secondary?: boolean;
2627
}
2728

2829
const SHADOW_RADIUS = 4;
@@ -43,17 +44,18 @@ const Thumb = (props: Props) => {
4344
shouldDisableRTL,
4445
shouldBounceToStep,
4546
stepInterpolatedValue,
46-
gap = 0
47+
gap = 0,
48+
secondary
4749
} = props;
4850

4951
const rtlFix = Constants.isRTL ? -1 : 1;
50-
const isPressedDefault = useSharedValue(false);
52+
const isPressed = useSharedValue(false);
5153
const thumbSize = useSharedValue({width: THUMB_SIZE, height: THUMB_SIZE});
5254
const lastOffset = useSharedValue(0);
5355

5456
const gesture = Gesture.Pan()
5557
.onBegin(() => {
56-
isPressedDefault.value = true;
58+
isPressed.value = true;
5759
lastOffset.value = offset.value;
5860
})
5961
.onUpdate(e => {
@@ -67,28 +69,30 @@ const Thumb = (props: Props) => {
6769
// adjust end edge
6870
newX = end.value;
6971
}
70-
if (newX < end.value - gap && newX > start.value + gap) {
72+
if (!secondary && newX < gap ||
73+
secondary && newX > end.value - gap ||
74+
newX < end.value - gap && newX > start.value + gap) {
7175
offset.value = newX;
7276
}
7377
})
7478
.onEnd(() => {
7579
onSeekEnd?.();
7680
})
7781
.onFinalize(() => {
78-
isPressedDefault.value = false;
82+
isPressed.value = false;
7983
if (shouldBounceToStep) {
8084
offset.value = Math.round(offset.value / stepInterpolatedValue.value) * stepInterpolatedValue.value;
8185
}
8286
});
8387
gesture.enabled(!disabled);
8488

8589
const animatedStyle = useAnimatedStyle(() => {
86-
const customStyle = isPressedDefault.value ? activeStyle?.value : defaultStyle?.value;
90+
const customStyle = isPressed.value ? activeStyle?.value : defaultStyle?.value;
8791
return {
8892
...customStyle,
8993
transform: [
9094
{translateX: (offset.value - thumbSize.value.width / 2) * rtlFix},
91-
{scale: withSpring(!disableActiveStyling && isPressedDefault.value ? 1.3 : 1)}
95+
{scale: withSpring(!disableActiveStyling && isPressed.value ? 1.3 : 1)}
9296
]
9397
};
9498
});

src/incubator/Slider/index.tsx

+3-2
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ const Slider = React.memo((props: Props) => {
5959
thumbHitSlop,
6060
disableActiveStyling,
6161
disabled,
62-
useGap,
62+
useGap = true,
6363
accessible,
6464
testID
6565
} = props;
@@ -214,7 +214,7 @@ const Slider = React.memo((props: Props) => {
214214
if (useRange) {
215215
return {
216216
transform: [{translateX: withTiming(defaultThumbOffset.value * rtlFix, {duration: 10})}],
217-
width: withTiming(rangeThumbOffset.value - defaultThumbOffset.value, {duration: 10})
217+
width: withTiming(Math.abs(rangeThumbOffset.value - defaultThumbOffset.value), {duration: 10})
218218
};
219219
} else {
220220
return {
@@ -232,6 +232,7 @@ const Slider = React.memo((props: Props) => {
232232
end={type === ThumbType.DEFAULT ? rangeThumbOffset : end}
233233
offset={type === ThumbType.DEFAULT ? defaultThumbOffset : rangeThumbOffset}
234234
gap={rangeGap}
235+
secondary={type !== ThumbType.DEFAULT}
235236
onSeekStart={onSeekStart}
236237
onSeekEnd={onSeekEnd}
237238
shouldDisableRTL={shouldDisableRTL}

src/style/colors.ts

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,10 +273,10 @@ export class Colors {
273273
return _.inRange(hue, 51, 184);
274274
}
275275

276-
isDark(colorValue: string | OpaqueColorValue) {
276+
isDark(colorValue: string | OpaqueColorValue, darkThreshold = 0.55) {
277277
const color = colorValue === null ? undefined : colorStringValue(colorValue);
278278
const lum = tinycolor(color).getLuminance();
279-
return lum < 0.55;
279+
return lum < darkThreshold;
280280
}
281281
isValidHex(string: string) {
282282
return /(^#[0-9A-F]{6}$)|(^#[0-9A-F]{3}$)/i.test(string);

0 commit comments

Comments
 (0)