Skip to content

Commit 02bead2

Browse files
committed
Use design tokens in MainScreen
1 parent f1ea3e0 commit 02bead2

File tree

1 file changed

+14
-15
lines changed

1 file changed

+14
-15
lines changed

demo/src/screens/MainScreen.js

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,17 @@ import {gestureHandlerRootHOC} from 'react-native-gesture-handler';
88
import {
99
Assets,
1010
Colors,
11+
Spacings,
1112
View,
1213
Text,
14+
TextField,
1315
TouchableOpacity,
1416
Icon,
1517
Button,
16-
TabController,
17-
Incubator
18+
TabController
1819
} from 'react-native-ui-lib'; //eslint-disable-line
1920
import {navigationData} from './MenuStructure';
2021

21-
const {TextField} = Incubator;
2222
const settingsIcon = require('../assets/icons/settings.png');
2323
const chevronIcon = require('../assets/icons/chevronRight.png');
2424

@@ -56,8 +56,6 @@ class MainScreen extends Component {
5656
filteredNavigationData: data
5757
};
5858

59-
this.filterExplorerScreens = _.throttle(this.filterExplorerScreens, 300);
60-
6159
Navigation.events().bindComponent(this);
6260
}
6361

@@ -119,11 +117,11 @@ class MainScreen extends Component {
119117
}, 0);
120118
};
121119

122-
updateSearch = filterText => {
120+
updateSearch = _.throttle(filterText => {
123121
this.setState({filterText}, () => {
124122
this.filterExplorerScreens();
125123
});
126-
};
124+
}, 800);
127125

128126
clearSearch = () => {
129127
this.updateSearch('');
@@ -164,8 +162,8 @@ class MainScreen extends Component {
164162
return (
165163
<TextField
166164
migrate
165+
preset={null}
167166
ref={r => (this.input = r)}
168-
value={filterText}
169167
testID="uilib.search_for_component"
170168
placeholder="Search for your component..."
171169
onChangeText={this.updateSearch}
@@ -178,9 +176,9 @@ class MainScreen extends Component {
178176
text70
179177
trailingAccessory={
180178
filterText ? (
181-
<Button link iconSource={Assets.icons.demo.close} grey10 onPress={this.clearSearch}/>
179+
<Button link iconSource={Assets.icons.demo.close} $iconDefault onPress={this.clearSearch}/>
182180
) : (
183-
<Icon source={Assets.icons.demo.search}/>
181+
<Icon tintColor={Colors.$iconDefault} source={Assets.icons.demo.search}/>
184182
)
185183
}
186184
/>
@@ -230,7 +228,7 @@ class MainScreen extends Component {
230228
keyboardShouldPersistTaps="always"
231229
data={flatData}
232230
contentContainerStyle={{paddingTop: 20}}
233-
keyExtractor={(item, index) => index.toString()}
231+
keyExtractor={(_item, index) => index.toString()}
234232
renderItem={this.renderItem}
235233
/>
236234
);
@@ -299,12 +297,13 @@ const styles = StyleSheet.create({
299297
textDecorationLine: 'line-through'
300298
},
301299
searchContainer: {
302-
padding: 16,
303-
paddingBottom: 0
300+
padding: Spacings.s4,
301+
paddingBottom: 0,
302+
marginBottom: Spacings.s2
304303
},
305304
searchField: {
306-
padding: 12,
307-
backgroundColor: Colors.grey80,
305+
padding: Spacings.s3,
306+
backgroundColor: Colors.$backgroundNeutralLight,
308307
borderRadius: 8
309308
}
310309
});

0 commit comments

Comments
 (0)