Create modal window

Asked

Viewed 605 times

1

I’m starting an app:

import React, { Component } from 'react';
import {
  StyleSheet,
  Text,
  View,
  StatusBar
} from 'react-native';
import Button from 'react-native-button';

import { Actions } from 'react-native-router-flux';

export default class ouvidoria extends Component {
  render() {
    return (
      <View style={styles.geral}>

        <StatusBar 
          //hidden
          backgroundColor='#005288'
        />

        <View style={styles.botao}>
          <Button
            onPress={() => { Actions.formaanonima(); }}
            containerStyle={{ padding:10, 
                              height:50,
                              width:300,
                              overflow:'hidden', 
                              //borderRadius:4, 
                              justifyContent: 'center',
                              alignItems: 'center',
                              backgroundColor: '#FFB504',
                              elevation: 10,
                              }}
            style={{fontSize: 24, 
                    color: '#000'
                    }}>
            Cadastrar Manifestação
          </Button>
        </View>

      </View>
    );
  }
}

const styles = StyleSheet.create({
  geral: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#005288',
  },
  botao: {

  }
});

I searched and couldn’t find how to open windows.

I would like when the user presses the button to open a window asking if it already has registration or not, only with the buttons yes and not to decide which route to follow.

However, I did not find this type of function in React-Native or third party material.

1 answer

3


A simple example

Alert.alert(
  'Alert Title',
  'My Alert Msg',
  [
    {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')},
    {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'},
    {text: 'OK', onPress: () => console.log('OK Pressed')},
  ],
  { cancelable: false }
)

You can see more here

  • Know if it is possible to edit the Alert window?

  • Alert has no configurable style as it uses the native Alert of each platform. You can use the Modal of React Native itself if you want to customize the window.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.