Skip to content

Modal's onDismiss callback is wrongly implemented in 0.61.0-rc.3 #26473

Closed
@wddwycc

Description

@wddwycc

Issue:

With This commit, onDismiss on Modal will never be called when dismissed, code below as an example.

const App = () => {
  const [visible, setVisible] = useState(true)
  const onClosePress = useCallback(() => setVisible(false), [])
  const onDismiss = useCallback(() => { console.log('dismiss') }, [])
  return (
    <View>
      <TouchableOpacity onPress={onClosePress}>
        <Text>Close</Text>
      </TouchableOpacity>
      <Modal visible={visible} onDismiss={onDismiss} />
    </View>
  )
}

This is not the intended behavior of this callback according to the document


React Native version:

System:
OS: macOS 10.14.4
CPU: (8) x64 Intel(R) Core(TM) i7-4770HQ CPU @ 2.20GHz
Memory: 1.32 GB / 16.00 GB
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.9.0 - /usr/local/bin/node
npm: 6.2.0 - /usr/local/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
SDKs:
iOS SDK:
Platforms: iOS 13.0, DriverKit 19.0, macOS 10.15, tvOS 13.0, watchOS 6.0
IDEs:
Xcode: 11.0/11A419c - /usr/bin/xcodebuild
npmPackages:
react: 16.9.0 => 16.9.0
react-native: 0.61.0-rc.3 => 0.61.0-rc.3

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions