Skip to content

Commit 654de56

Browse files
ArnonZethanshar
andauthored
Renaming TagsInput to ChipsInput (#955)
* Initial renaming of TagsInput to ChipsInput * Cosmetics * Lint * Updating deprecation warning msg * Adding ChipsInput typings export * Removing deprecation from tests * Update src/index.js Co-authored-by: Ethan Sharabi <[email protected]> * Removing extend link * Updating extends link * Update src/components/index.js Co-authored-by: Ethan Sharabi <[email protected]> * Deleting wrong extend Co-authored-by: Ethan Sharabi <[email protected]>
1 parent bbf80bc commit 654de56

File tree

14 files changed

+530
-49
lines changed

14 files changed

+530
-49
lines changed

demo/src/index.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ module.exports = {
4949
get ExpandableSectionScreen() {
5050
return require('./screens/componentScreens/ExpandableSectionScreen').default;
5151
},
52-
get TagsInputScreen() {
53-
return require('./screens/componentScreens/TagsInputScreen').default;
52+
get ChipsInputScreen() {
53+
return require('./screens/componentScreens/ChipsInputScreen').default;
5454
},
5555
get HintsScreen() {
5656
return require('./screens/componentScreens/HintsScreen').default;
@@ -106,7 +106,7 @@ module.exports = {
106106
get TextScreen() {
107107
return require('./screens/componentScreens/TextScreen').default;
108108
},
109-
// TODO: fix Expo issues (navigation) before un-commenting
109+
// TODO: fix Expo issues (navigation) before un-commenting
110110
// get TextFieldScreen() {
111111
// return require('./screens/componentScreens/TextFieldScreen').default;
112112
// },
@@ -160,7 +160,7 @@ module.exports = {
160160
get LoadingScreen() {
161161
return require('./screens/componentScreens/LoadingScreen').default;
162162
},
163-
// TODO: fix Expo issues (navigation) before un-commenting
163+
// TODO: fix Expo issues (navigation) before un-commenting
164164
// get ModalScreen() {
165165
// return require('./screens/componentScreens/ModalScreen').default;
166166
// },

demo/src/screens/MenuStructure.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export const navigationData = {
5858
{title: 'Stepper', tags: 'stepper form', screen: 'unicorn.components.StepperScreen'},
5959
{title: 'Slider', tags: 'slider', screen: 'unicorn.components.SliderScreen'},
6060
{title: 'Switch', tags: 'switch toggle', screen: 'unicorn.components.SwitchScreen'},
61-
{title: 'TagsInput', tags: 'tags input form', screen: 'unicorn.components.TagsInputScreen'},
61+
{title: 'ChipsInput', tags: 'chips tags input form', screen: 'unicorn.components.ChipsInputScreen'},
6262
{title: 'Masked Inputs', tags: 'text input form mask', screen: 'unicorn.components.MaskedInputScreen'}
6363
]
6464
},

demo/src/screens/componentScreens/TagsInputScreen.js renamed to demo/src/screens/componentScreens/ChipsInputScreen.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
import React, {Component} from 'react';
22
import {StyleSheet, ScrollView} from 'react-native';
3-
import {View, Colors, Text, Typography, TagsInput} from 'react-native-ui-lib'; // eslint-disable-line
3+
import {View, Colors, Text, Typography, ChipsInput} from 'react-native-ui-lib'; // eslint-disable-line
44

55

6-
export default class TagsInputScreen extends Component {
6+
export default class ChipsInputScreen extends Component {
77
constructor(props) {
88
super(props);
99

1010
this.state = {
1111
tags: [{label: 'Amit'}, {label: 'Ethan', invalid: true}],
12-
tags2: ['Tags', 'Input'],
12+
tags2: ['Chips', 'Input'],
1313
tags3: ['Non', 'Removable', 'Tags']
1414
};
1515
}
1616

1717
onTagPress = (tagIndex, markedTagIndex) => {
18-
this.customTagsInput.markTagIndex(tagIndex === markedTagIndex ? undefined : tagIndex);
18+
this.customChipsInput.markTagIndex(tagIndex === markedTagIndex ? undefined : tagIndex);
1919
};
2020

2121
renderCustomTag(tag, index, shouldMarkToRemove) {
@@ -31,24 +31,24 @@ export default class TagsInputScreen extends Component {
3131
<ScrollView keyboardShouldPersistTaps="never">
3232
<View style={styles.container}>
3333
<Text text40 marginB-20>
34-
TagsInput
34+
ChipsInput
3535
</Text>
3636

37-
<TagsInput containerStyle={{marginBottom: 25}} placeholder="Enter Tags" tags={this.state.tags2}/>
37+
<ChipsInput containerStyle={{marginBottom: 25}} placeholder="Enter Tags" tags={this.state.tags2}/>
3838

39-
<TagsInput containerStyle={{marginBottom: 25}} placeholder="Enter Tags" tags={this.state.tags}
39+
<ChipsInput containerStyle={{marginBottom: 25}} placeholder="Enter Tags" tags={this.state.tags}
4040
validationErrorMessage="error validation message" />
4141

42-
<TagsInput
42+
<ChipsInput
4343
containerStyle={{marginBottom: 25}}
4444
placeholder="Editing disabled"
4545
tags={this.state.tags3}
4646
disableTagRemoval
4747
disableTagAdding
4848
/>
4949

50-
<TagsInput
51-
ref={r => (this.customTagsInput = r)}
50+
<ChipsInput
51+
ref={r => (this.customChipsInput = r)}
5252
containerStyle={{marginBottom: 25}}
5353
placeholder="With custom tags"
5454
tags={this.state.tags}

demo/src/screens/componentScreens/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export function registerScreens(registrar) {
1616
registrar('unicorn.components.DialogScreen', () => require('./DialogScreen').default);
1717
registrar('unicorn.components.DrawerScreen', () => require('./DrawerScreen').default);
1818
registrar('unicorn.components.ExpandableSectionScreen', () => require('./ExpandableSectionScreen').default);
19-
registrar('unicorn.components.TagsInputScreen', () => require('./TagsInputScreen').default);
19+
registrar('unicorn.components.ChipsInputScreen', () => require('./ChipsInputScreen').default);
2020
registrar('unicorn.components.HintsScreen', () => require('./HintsScreen').default);
2121
registrar('unicorn.components.ImageScreen', () => require('./ImageScreen').default);
2222
registrar('unicorn.components.ProgressiveImageScreen', () => require('./ProgressiveImageScreen').default);

generatedTypes/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ export {
6363
ColorSliderGroup,
6464
Stepper,
6565
TagsInput,
66+
ChipsInput,
6667
SharedTransition,
6768
StackAggregator,
6869
Toast,

src/components/tagsInput/__tests__/index.spec.js renamed to src/components/chipsInput/__tests__/index.spec.js

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import _ from 'lodash';
22
import {Constants} from '../../../helpers';
3-
import TagsInput from '../index';
3+
import ChipsInput from '../index';
44

5-
describe('TagsInput', () => {
5+
describe('ChipsInput', () => {
66
let uut;
77
beforeEach(() => {
8-
uut = new TagsInput({});
8+
uut = new ChipsInput({});
99
uut.setState = jest.fn(state => _.assign(uut.state, state));
1010
_.set(uut.state, 'tags', [{}, {}, {}]);
1111
});
@@ -23,13 +23,13 @@ describe('TagsInput', () => {
2323

2424
it('should return the label according to getLabel callback provided in props', () => {
2525
const getLabel = jest.fn(item => item.value);
26-
uut = new TagsInput({getLabel});
26+
uut = new ChipsInput({getLabel});
2727
expect(uut.getLabel({value: 'label', label: 'bla'})).toBe('label');
2828
});
2929

3030
it('should return the label according to getLabel callback even if item is a string', () => {
3131
const getLabel = jest.fn(item => `${item}1`);
32-
uut = new TagsInput({getLabel});
32+
uut = new ChipsInput({getLabel});
3333
expect(uut.getLabel('label')).toBe('label1');
3434
});
3535
});
@@ -82,7 +82,7 @@ describe('TagsInput', () => {
8282
it('should invoke onKeyPress callback provided in props with the event', () => {
8383
const pressEvent = {nativeEvent: {key: 'space'}};
8484
const onKeyPressCallback = jest.fn();
85-
uut = new TagsInput({onKeyPress: onKeyPressCallback});
85+
uut = new ChipsInput({onKeyPress: onKeyPressCallback});
8686

8787
uut.onKeyPress(pressEvent);
8888
expect(onKeyPressCallback).toHaveBeenCalledWith(pressEvent);

0 commit comments

Comments
 (0)