selvamk-js / sharingan-rn-modal-dropdown

A simple and customizable react-native dropdown created using react-native-modal and react-native-paper.
MIT License
85 stars 28 forks source link

Updating state is not refreshing the component #31

Open ashsharma1 opened 3 years ago

ashsharma1 commented 3 years ago

import address1sList from './data/address1s_list.json';

export default AddContact = ({navigation}) => { const [address1, setAddress1] = useState();

const changeAddress1 = () => { setAddress1(null); }; render ( ... <Dropdown label="village" required data={address1sList} enableSearch value={address1} onChange={setAddress1} emptyListText="Select District First" /> ... );

If I were to change address1 via a function, it does not re-render the Dropdown component in the render. How can I make this reactive?

ravimaurya-nickelfox commented 3 years ago

You mean resetting the state? You should try this @ashsharma1 https://github.com/ravimaurya-nickelfox/sharingan-rn-modal-dropdown