From f898bb65fac3f26944cbe1c47b87c63b2cd10e03 Mon Sep 17 00:00:00 2001 From: Ankit Tiwari Date: Sun, 12 Jul 2020 19:55:14 -0700 Subject: [PATCH] Fix alert screen crash in android in RNTester app (#29150) Summary: fixes - https://github.com/MLH-Fellowship/react-native/issues/21 [Reviewed by jevakallio](https://github.com/MLH-Fellowship/react-native/pull/22) ## Changelog Before: ![image](https://user-images.githubusercontent.com/22813027/84471321-ba63bf00-aca2-11ea-92c0-3b43a8bdd28a.png) After: Screenshot 2020-06-12 at 11 49 31 AM Pull Request resolved: https://github.com/facebook/react-native/pull/29150 Test Plan: 1. Run the RNTester app locally on both android and iOS. 2. Open the Alert API screen. 3. Alert examples should be visible and functional in both android and iOS. Screenshot for both android and iOS screens- Screenshot 2020-06-12 at 11 52 21 AM Reviewed By: cpojer Differential Revision: D22067670 Pulled By: rickhanlonii fbshipit-source-id: e7c43b77a30ae2e258303ce84f7fc4dee63776e6 --- RNTester/js/examples/Alert/AlertExample.js | 36 +++++++++------------- RNTester/js/utils/RNTesterList.android.js | 2 +- 2 files changed, 15 insertions(+), 23 deletions(-) diff --git a/RNTester/js/examples/Alert/AlertExample.js b/RNTester/js/examples/Alert/AlertExample.js index 4e362a525f9..dfafd870cf3 100644 --- a/RNTester/js/examples/Alert/AlertExample.js +++ b/RNTester/js/examples/Alert/AlertExample.js @@ -18,8 +18,6 @@ const { View, } = require('react-native'); -const RNTesterBlock = require('../../components/RNTesterBlock'); - // corporate ipsum > lorem ipsum const alertMessage = 'Credibly reintermediate next-generation potentialities after goal-oriented ' + @@ -125,22 +123,6 @@ class SimpleAlertExampleBlock extends React.Component { } } -class AlertExample extends React.Component { - static title = 'Alert'; - - static description = - 'Alerts display a concise and informative message ' + - 'and prompt the user to make a decision.'; - - render() { - return ( - - - - ); - } -} - const styles = StyleSheet.create({ wrapper: { borderRadius: 5, @@ -152,7 +134,17 @@ const styles = StyleSheet.create({ }, }); -module.exports = { - AlertExample, - SimpleAlertExampleBlock, -}; +exports.title = 'Alert'; +exports.description = + 'Alerts display a concise and informative message ' + + 'and prompt the user to make a decision.'; +exports.examples = [ + { + title: 'Alerts', + render(): React.Node { + return ; + }, + }, +]; + +exports.SimpleAlertExampleBlock = SimpleAlertExampleBlock; diff --git a/RNTester/js/utils/RNTesterList.android.js b/RNTester/js/utils/RNTesterList.android.js index 0e01adf9f0c..2b1b921efe7 100644 --- a/RNTester/js/utils/RNTesterList.android.js +++ b/RNTester/js/utils/RNTesterList.android.js @@ -122,7 +122,7 @@ const APIExamples: Array = [ }, { key: 'AlertExample', - module: require('../examples/Alert/AlertExample').AlertExample, + module: require('../examples/Alert/AlertExample'), }, { key: 'AnimatedExample',