react-component / m-picker

React Mobile Picker(web & react-native)
http://react-component.github.io/m-picker/
247 stars 73 forks source link

初始化时不会触发onValueChange事件 #235

Open PiNengShaoNian opened 4 years ago

PiNengShaoNian commented 4 years ago

复现代码

function App() {
  const [value, setValue] = useState([]);

  const onChange = value => {
    console.log(value);
    setValue(value);
  };
  return (
    <div className="App">
      <MultiPicker selectedValue={value} onValueChange={onChange}>
        <Picker indicatorClassName="my-picker-indicator">
          <Picker.Item className="my-picker-view-item" value="1">
            one
          </Picker.Item>
        </Picker>
      </MultiPicker>
    </div>
  );
}

期待效果 初始化时触发onValueChange事件