Skip to content

Commit eda388f

Browse files
committed
Merge branch 'master' into demo-screen-language-picker
2 parents 231cc7a + b272134 commit eda388f

File tree

12 files changed

+216
-161
lines changed

12 files changed

+216
-161
lines changed

.github/stale.yml

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# Configuration for probot-stale - https://github.com/probot/stale
2+
3+
# Number of days of inactivity before an Issue or Pull Request becomes stale
4+
daysUntilStale: 60
5+
6+
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
7+
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
8+
daysUntilClose: 7
9+
10+
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
11+
onlyLabels: []
12+
13+
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
14+
exemptLabels:
15+
- pinned
16+
- WIP
17+
- bug
18+
- "feature request"
19+
- "typescript"
20+
21+
# Set to true to ignore issues in a project (defaults to false)
22+
exemptProjects: false
23+
24+
# Set to true to ignore issues in a milestone (defaults to false)
25+
exemptMilestones: false
26+
27+
# Set to true to ignore issues with an assignee (defaults to false)
28+
exemptAssignees: false
29+
30+
# Label to use when marking as stale
31+
staleLabel: wontfix
32+
33+
# Comment to post when marking as stale. Set to `false` to disable
34+
markComment: >
35+
This issue has been automatically marked as stale because it has not had
36+
recent activity. It will be closed if no further activity occurs. Thank you
37+
for your contributions.
38+
39+
# Comment to post when removing the stale label.
40+
# unmarkComment: >
41+
# Your comment here.
42+
43+
# Comment to post when closing a stale Issue or Pull Request.
44+
# closeComment: >
45+
# Your comment here.
46+
47+
# Limit the number of actions per hour, from 1-30. Default is 30
48+
limitPerRun: 30
49+
50+
# Limit to only `issues` or `pulls`
51+
# only: issues
52+
53+
# Optionally, specify configuration settings that are specific to just 'issues' or 'pulls':
54+
# pulls:
55+
# daysUntilStale: 30
56+
# markComment: >
57+
# This pull request has been automatically marked as stale because it has not had
58+
# recent activity. It will be closed if no further activity occurs. Thank you
59+
# for your contributions.
60+
61+
# issues:
62+
# exemptLabels:
63+
# - confirmed

demo/src/screens/componentScreens/WithScrollEnablerScreen/AutoLockFlatList.tsx

Lines changed: 55 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,96 +1,81 @@
11
import _ from 'lodash';
22
import React, {memo, useCallback} from 'react';
3-
import {
4-
FlatList,
5-
FlatListProps,
6-
StyleSheet,
7-
LayoutChangeEvent
8-
} from 'react-native';
3+
// eslint-disable-next-line no-unused-vars
4+
import {FlatList, StyleSheet, LayoutChangeEvent} from 'react-native';
95
import {
106
Colors,
117
Text,
128
View,
139
withScrollEnabler,
10+
// eslint-disable-next-line no-unused-vars
1411
WithScrollEnablerProps
1512
} from 'react-native-ui-lib';
1613

17-
export type AutoLockScrollViewProps = FlatListProps<number> & {
14+
export type AutoLockScrollViewProps = WithScrollEnablerProps & {
15+
horizontal?: boolean;
1816
numberOfItems: number;
17+
onContentSizeChange: (contentWidth: number, contentHeight: number) => void;
18+
onLayout: (event: LayoutChangeEvent) => void;
1919
};
2020

21-
const AutoLockFlatList = (props: AutoLockScrollViewProps) => {
21+
const WithScrollEnabler = (props: AutoLockScrollViewProps) => {
2222
const numberOfItems = props.numberOfItems;
2323

24-
const WithScrollEnabler = withScrollEnabler(
25-
useCallback(
26-
(props: WithScrollEnablerProps) => {
27-
const getData = useCallback(
28-
(numberOfItems: number) => {
29-
return [...Array(numberOfItems).keys()];
30-
},
31-
[numberOfItems]
32-
);
33-
34-
const keyExtractor = useCallback((item: number) => {
35-
return item.toString();
36-
}, []);
24+
const getData = useCallback((numberOfItems: number) => {
25+
return [...Array(numberOfItems).keys()];
26+
}, []);
3727

38-
const renderItem = useCallback(({index}: {index: number}) => {
39-
return (
40-
<View key={index} style={styles.item}>
41-
<Text>{index + 1}</Text>
42-
</View>
43-
);
44-
}, []);
28+
const keyExtractor = useCallback((item: number) => {
29+
return item.toString();
30+
}, []);
4531

46-
const onContentSizeChange = useCallback(
47-
(contentWidth: number, contentHeight: number) => {
48-
_.invoke(props, 'onContentSizeChange', contentWidth, contentHeight);
49-
_.invoke(
50-
props,
51-
'scrollEnablerProps.onContentSizeChange',
52-
contentWidth,
53-
contentHeight
54-
);
55-
},
56-
[
57-
props.onContentSizeChange,
58-
props.scrollEnablerProps.onContentSizeChange
59-
]
60-
);
32+
const renderItem = useCallback(({index}: {index: number}) => {
33+
return (
34+
<View key={index} style={styles.item}>
35+
<Text>{index + 1}</Text>
36+
</View>
37+
);
38+
}, []);
6139

62-
const onLayout = useCallback(
63-
(nativeEvent: LayoutChangeEvent) => {
64-
_.invoke(props, 'onLayout', nativeEvent);
65-
_.invoke(props, 'scrollEnablerProps.onLayout', nativeEvent);
66-
},
67-
[props.onLayout, props.scrollEnablerProps.onLayout]
68-
);
40+
const onContentSizeChange = useCallback(
41+
(contentWidth: number, contentHeight: number) => {
42+
_.invoke(props, 'onContentSizeChange', contentWidth, contentHeight);
43+
_.invoke(
44+
props,
45+
'scrollEnablerProps.onContentSizeChange',
46+
contentWidth,
47+
contentHeight
48+
);
49+
},
50+
[props.onContentSizeChange, props.scrollEnablerProps.onContentSizeChange]
51+
);
6952

70-
return (
71-
<FlatList
72-
{...props}
73-
style={styles.flatList}
74-
contentContainerStyle={styles.flatListContainer}
75-
showsHorizontalScrollIndicator={false}
76-
showsVerticalScrollIndicator={false}
77-
data={getData(numberOfItems)}
78-
renderItem={renderItem}
79-
keyExtractor={keyExtractor}
80-
onContentSizeChange={onContentSizeChange}
81-
onLayout={onLayout}
82-
scrollEnabled={props.scrollEnablerProps.scrollEnabled}
83-
/>
84-
);
85-
},
86-
[numberOfItems]
87-
)
53+
const onLayout = useCallback(
54+
(nativeEvent: LayoutChangeEvent) => {
55+
_.invoke(props, 'onLayout', nativeEvent);
56+
_.invoke(props, 'scrollEnablerProps.onLayout', nativeEvent);
57+
},
58+
[props.onLayout, props.scrollEnablerProps.onLayout]
8859
);
8960

90-
return <WithScrollEnabler {...props} />;
61+
return (
62+
<FlatList
63+
{...props}
64+
style={styles.flatList}
65+
contentContainerStyle={styles.flatListContainer}
66+
showsHorizontalScrollIndicator={false}
67+
showsVerticalScrollIndicator={false}
68+
data={getData(numberOfItems)}
69+
renderItem={renderItem}
70+
keyExtractor={keyExtractor}
71+
onContentSizeChange={onContentSizeChange}
72+
onLayout={onLayout}
73+
scrollEnabled={props.scrollEnablerProps.scrollEnabled}
74+
/>
75+
);
9176
};
9277

93-
export default memo(AutoLockFlatList);
78+
export default memo(withScrollEnabler(WithScrollEnabler));
9479

9580
const styles = StyleSheet.create({
9681
flatList: {

demo/src/screens/componentScreens/WithScrollEnablerScreen/AutoLockScrollView.tsx

Lines changed: 48 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,84 +1,71 @@
11
import _ from 'lodash';
22
import React, {memo, useCallback} from 'react';
3-
import {
4-
ScrollView,
5-
ScrollViewProps,
6-
StyleSheet,
7-
LayoutChangeEvent
8-
} from 'react-native';
3+
// eslint-disable-next-line no-unused-vars
4+
import {ScrollView, StyleSheet, LayoutChangeEvent} from 'react-native';
95
import {
106
Colors,
117
Text,
128
View,
139
withScrollEnabler,
10+
// eslint-disable-next-line no-unused-vars
1411
WithScrollEnablerProps
1512
} from 'react-native-ui-lib';
1613

17-
export type AutoLockScrollViewProps = ScrollViewProps & {
14+
export type AutoLockScrollViewProps = WithScrollEnablerProps & {
15+
horizontal?: boolean;
1816
numberOfItems: number;
17+
onContentSizeChange: (contentWidth: number, contentHeight: number) => void;
18+
onLayout: (event: LayoutChangeEvent) => void;
1919
};
2020

21-
const AutoLockScrollView = (props: AutoLockScrollViewProps) => {
21+
const WithScrollEnabler = (props: AutoLockScrollViewProps) => {
2222
const numberOfItems = props.numberOfItems;
23+
const renderItem = useCallback((index: number) => {
24+
return (
25+
<View key={index} style={styles.item}>
26+
<Text>{index + 1}</Text>
27+
</View>
28+
);
29+
}, []);
2330

24-
const WithScrollEnabler = withScrollEnabler(
25-
useCallback(
26-
(props: WithScrollEnablerProps) => {
27-
const renderItem = useCallback((index: number) => {
28-
return (
29-
<View key={index} style={styles.item}>
30-
<Text>{index + 1}</Text>
31-
</View>
32-
);
33-
}, []);
34-
35-
const onContentSizeChange = useCallback(
36-
(contentWidth: number, contentHeight: number) => {
37-
_.invoke(props, 'onContentSizeChange', contentWidth, contentHeight);
38-
_.invoke(
39-
props,
40-
'scrollEnablerProps.onContentSizeChange',
41-
contentWidth,
42-
contentHeight
43-
);
44-
},
45-
[
46-
props.onContentSizeChange,
47-
props.scrollEnablerProps.onContentSizeChange
48-
]
49-
);
50-
51-
const onLayout = useCallback(
52-
(nativeEvent: LayoutChangeEvent) => {
53-
_.invoke(props, 'onLayout', nativeEvent);
54-
_.invoke(props, 'scrollEnablerProps.onLayout', nativeEvent);
55-
},
56-
[props.onLayout, props.scrollEnablerProps.onLayout]
57-
);
31+
const onContentSizeChange = useCallback(
32+
(contentWidth: number, contentHeight: number) => {
33+
_.invoke(props, 'onContentSizeChange', contentWidth, contentHeight);
34+
_.invoke(
35+
props,
36+
'scrollEnablerProps.onContentSizeChange',
37+
contentWidth,
38+
contentHeight
39+
);
40+
},
41+
[props.onContentSizeChange, props.scrollEnablerProps.onContentSizeChange]
42+
);
5843

59-
return (
60-
<ScrollView
61-
{...props}
62-
style={styles.scrollView}
63-
contentContainerStyle={styles.scrollViewContainer}
64-
showsHorizontalScrollIndicator={false}
65-
showsVerticalScrollIndicator={false}
66-
onContentSizeChange={onContentSizeChange}
67-
onLayout={onLayout}
68-
scrollEnabled={props.scrollEnablerProps.scrollEnabled}
69-
>
70-
{_.times(numberOfItems, renderItem)}
71-
</ScrollView>
72-
);
73-
},
74-
[numberOfItems]
75-
)
44+
const onLayout = useCallback(
45+
(nativeEvent: LayoutChangeEvent) => {
46+
_.invoke(props, 'onLayout', nativeEvent);
47+
_.invoke(props, 'scrollEnablerProps.onLayout', nativeEvent);
48+
},
49+
[props.onLayout, props.scrollEnablerProps.onLayout]
7650
);
7751

78-
return <WithScrollEnabler {...props} />;
52+
return (
53+
<ScrollView
54+
{...props}
55+
style={styles.scrollView}
56+
contentContainerStyle={styles.scrollViewContainer}
57+
showsHorizontalScrollIndicator={false}
58+
showsVerticalScrollIndicator={false}
59+
onContentSizeChange={onContentSizeChange}
60+
onLayout={onLayout}
61+
scrollEnabled={props.scrollEnablerProps.scrollEnabled}
62+
>
63+
{_.times(numberOfItems, renderItem)}
64+
</ScrollView>
65+
);
7966
};
8067

81-
export default memo(AutoLockScrollView);
68+
export default memo(withScrollEnabler(WithScrollEnabler));
8269

8370
const styles = StyleSheet.create({
8471
scrollView: {

demo/src/screens/componentScreens/WithScrollEnablerScreen/index.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,12 @@
11
import React, {Component} from 'react';
2+
// eslint-disable-next-line no-unused-vars
23
import {LayoutChangeEvent} from 'react-native';
34
import {Text, View} from 'react-native-ui-lib';
45
import {
56
renderHeader,
67
renderBooleanOption,
78
renderSliderOption
9+
// @ts-ignore
810
} from '../../ExampleScreenPresenter';
911
import AutoLockScrollView from './AutoLockScrollView';
1012
import AutoLockFlatList from './AutoLockFlatList';
@@ -49,7 +51,6 @@ class WithScrollEnablerScreen extends Component {
4951
const Container = isListView ? AutoLockScrollView : AutoLockFlatList;
5052

5153
return (
52-
// @ts-ignore
5354
<Container
5455
key={`${isHorizontal}`}
5556
horizontal={isHorizontal}
Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
11
import React from 'react';
2-
import { FlatListProps, ScrollViewProps, LayoutChangeEvent } from 'react-native';
2+
import { LayoutChangeEvent } from 'react-native';
33
export declare type ScrollEnablerProps = {
44
onContentSizeChange: (contentWidth: number, contentHeight: number) => void;
55
onLayout: (event: LayoutChangeEvent) => void;
66
scrollEnabled: boolean;
77
};
8-
declare type SupportedViews = FlatListProps<any> | ScrollViewProps;
9-
export declare type WithScrollEnablerProps = SupportedViews & {
8+
export declare type WithScrollEnablerProps = {
109
scrollEnablerProps: ScrollEnablerProps;
1110
ref?: any;
1211
};
13-
declare function withScrollEnabler<PROPS extends SupportedViews>(WrappedComponent: React.ComponentType<WithScrollEnablerProps>): React.ComponentType<PROPS>;
12+
declare function withScrollEnabler<PROPS>(WrappedComponent: React.ComponentType<PROPS & WithScrollEnablerProps>): React.ComponentType<PROPS>;
1413
export default withScrollEnabler;

generatedTypes/components/radioButton/RadioButton.d.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
import React from 'react';
22
import { TextStyle, ImageSourcePropType, ImageStyle, ViewProps } from 'react-native';
3-
import { BaseComponentInjectedProps, ForwardRefInjectedProps } from '../../commons/new';
43
import { RadioGroupContextPropTypes } from './RadioGroupContext';
5-
export declare type RadioButtonPropTypes = RadioGroupContextPropTypes & BaseComponentInjectedProps & ForwardRefInjectedProps & ViewProps & {
4+
export declare type RadioButtonPropTypes = RadioGroupContextPropTypes & ViewProps & {
65
/**
76
* The identifier value of the radio button. must be different than other RadioButtons in the same group
87
*/

0 commit comments

Comments
 (0)