React-native-web: Adding an Alert API

Created on 20 May 2016  路  7Comments  路  Source: necolas/react-native-web

Is there any interest in this? In its simplest form, the web version can use alert().

Most helpful comment

All 7 comments

We shouldn't introduce use of APIs like alert or prompt, which means this would need to be built from scratch. We don't currently have a need for this API at Twitter; no intent to bring this API to Web at the moment.

@necolas so you'd like a View component that will be displayed over the application?

@necolas @jsierles The problem here, is that, the only solution to make this work with something different from browser alert api, is to introduce an Alert layer in top of all react-native-web application. render of ReactNativeApp should look like:

return (
  <View style={styles.appContainer}>
    <RootComponent {...initialProps} rootTag={rootTag} />
    <Alert.View />
  </View>
);

thoughts?

Does anyone know of any other ways that we can polyfill React Native's Alert API on the web? Looking for something to hold me over until #305 gets merged, since that PR has been sitting stale for awhile. Thanks!

@joncursi You can ref my pr as dependency in package.json.
"react-native-web": "git+https://github.com/vaukalak/react-native-web.git#cbde40dc803d18f029c1c1352e2a925805ca0823",
Then on postinstall I run following script:

#fix react-native-web
pushd node_modules/react-native-web
yarn && npm run compile
rm -rf types
rm -rf docs
rm -rf benchmarks
rm -rf node_modules
rm -rf .github
rm .eslintrc
rm .flowconfig
rm .gitignore
rm webpack.config.js
rm core.js
rm yarn.lock
rm .travis.yml
popd

Any updates on when the PR will be merged?

Was this page helpful?
0 / 5 - 0 ratings

Related issues

iksent picture iksent  路  3Comments

roryabraham picture roryabraham  路  3Comments

necolas picture necolas  路  3Comments

bcpugh picture bcpugh  路  3Comments

SamyPesse picture SamyPesse  路  3Comments