Git Product home page Git Product logo

react-native-email-chip's Introduction

@arelstone/react-native-email-chip

A simple yet very customizable component to display a chip list of emails

@arelstone/react-native-email-chip

Install

npm install @arelstone/react-native-email-chip
// or
yarn add @arelstone/react-native-email-chip

Usage

import EmailChipInput from '@arelstone/react-native-email-chip';

<EmailChipInput
    entries={['[email protected]', '[email protected]']}
    onSubmit={(emails: string[])=> this.setState({emails})}
/>

Props

Name Type Default
entries string[] []
onSubmit string[] => void
label (optional) ReactElement
delimiters (optional) string[] [',', ';', ' ']
keyboardAppearance (optional) default, light, dark default
keyboardAppearance (optional) never, while-editing, unless-editing, always while-editing
placeholder (optional) string Start by typing an email
autoCapitalize (optional) none, sentences, words, characters none
autoCorrect (optional) boolean true
autoFocus (optional) boolean true
blurOnSubmit (optional) boolean false
chipImage (optional) ReactElement
placeholderTextColor (optional) ViewStyle
containerStyle (optional) ViewStyle
chipContainerStyle (optional) ViewStyle
chipTextStyle (optional) TextStyle
inputContainerStyle (optional) ViewStyle
inputStyle (optional) ViewStyle
TextInputProps (optional) TextInputProps
keyboardType (optional) KeyboardTypeOptions email-address

Contributing

If you find a feature missing or discover an issue pull requests are very very welcome.

react-native-email-chip's People

Contributors

arelstone avatar dependabot-preview[bot] avatar dependabot[bot] avatar frikkiesnyman avatar snieuw avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

react-native-email-chip's Issues

Email input is not accepting input, whatever I type input is cleared

When typing in the email input, the input is cleared.
My code block is attached below:

function PlayerInvitationScreen(props: any) {
    const [emails, setEmails] = useState<string[]>([]);
    return (
       <View>
           <View style={styles.image}>
                <Image source={require('../assets/images/letter.png')}/>
           </View>
           <View style={styles.textContainer}>
               <Text textSize='2xl' style={{fontWeight:'bold'}}>Invite User</Text>
           </View>
           <EmailChipInput
               entries={emails}
               onSubmit={(emails: string[]) => setEmails(emails)}
           />
       </View>
    )
}

I am using the version 2.5.2
I have attached the recorded video.

Screen.Recording.2023-04-17.at.12.30.27.PM.mov

App crash observed on Android with Swift/Samsung keyboard when multiline is set to true

I am using the latest version of Email Chip Input library. When there are multiple Email Chip components placed one beneath the other with multiline being set to true, App crash is observed when ENter key is pressed on Android (all OS versions) with Swift Keyboard and Samsung keyboard. This issue is not seen when Enter key is pressed with Gboard.

Scenario:

  1. Type in some content in 1st EMail Chip Input
  2. Tap on the second chip input and enter some content there.
  3. Now tap on the first email chip input and type some content and press return key from soft keyboard on the device. - App crashes. This is a consistent behavior

Please note that the above scenario works perfectly fine when TextInput(RN component) alone is used.

Observed with latest version of email chip input and RN version 0.60.5 & 0.63.3.

Any inputs to address this will be greatly appreciated

Code used to validate has been furnished below:

`import EmailChipInput from '@arelstone/react-native-email-chip';
import React, {Component} from 'react';
import {StyleSheet, View} from 'react-native';
class App extends Component {
render() {
return (

<EmailChipInput
delimiters={[',', ';', ' ']}
entries={[]}
TextInputProps={{multiline: true}}
/>
<EmailChipInput
delimiters={[',', ';', ' ']}
entries={[]}
TextInputProps={{multiline: true}}
/>
<EmailChipInput
delimiters={[',', ';', ' ']}
entries={[]}
TextInputProps={{multiline: true}}
/>

);
}
}
export default App;

const styles = StyleSheet.create({
container: {
paddingTop: 23,
},
input: {
margin: 15,
height: 60,
borderColor: '#7a42f4',
borderWidth: 1,
},
});
`

Cannot use import statement outside a module

I wrapped EmailChipInput into another component, mainly to set some default values for the props. This helps me use the email input in different parts of the app, without passing props for style customization over and over. Then, I created a simple unit test for my wrapper component, but when I run it I get this error:

โ— Test suite failed to run

    myProject/node_modules/@arelstone/react-native-email-chip/index.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,global,jest){import EmailChipInput from './src/EmailChipInput'
                                                                                             ^^^^^^

    SyntaxError: Cannot use import statement outside a module

I'm using Jest, and test code of my wrapper component looks like this:

import React from 'react';
import 'react-native';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import MyEmailInput from '@components/MyEmailInput';

describe('MyEmailInput', () => {
  it('renders correctly', () => {
    const component = shallow(<MyEmailInput onSubmit={() => {}} emails={[]} />);

    expect(toJson(component)).toMatchSnapshot();
  });
});

I ended up removing this unit test due to its failure. Is there anything you could do to help me address this problem?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.