1

I am working on React Native application. I am using "react-native-dialog". I want to change the height and width of the dialog. I am unable to do it. My code is:

import Dialog from "react-native-dialog";

<Dialog.Container style={{height: "50%", width: "50%"}} visible={this.state.dialogVisible}>

    <Dialog.Title>Edit Your Note</Dialog.Title>

    <Dialog.Input multiline={true} onChangeText={(nm)=> this.setState({newNote: nm})}
    value={this.state.newNote}></Dialog.Input>

    <Dialog.Button label="Cancel" onPress={() => this.handleCancel(e.ans)} />
    <Dialog.Button label="Save" onPress={() => this.handleSave(e.idx, e.ans)} />
  </Dialog.Container>

I want to increase the height and width of the dialog so that i can increase the height and width of the "Dialog.Input". Currently my dialog looks like this:

enter image description here

2
  • 1
    I dont see a style prop for this component. You should play with contentStyle, headerStyle and wrapperStyle. Refer to the docs Commented Aug 27, 2019 at 10:08
  • Yes, i too did not find Style prop, thats why i posted here Commented Aug 27, 2019 at 10:10

2 Answers 2

1

You need to add View in Container . I hope it will helps you.

     <Dialog.Container visible={this.state.dialogVisible} style={{ 
       justifyContent:'center', alignItems: 'center', backgroundColor: 'pink' }}>
         <View style={{ height: '70%', width: '70%' }}>
           <Dialog.Title>Edit Your Note</Dialog.Title>

           <Dialog.Input multiline={true} onChangeText={(nm) => 
          this.setState({ newNote: nm })}
             value={this.state.newNote}></Dialog.Input>
         </View>
         <Dialog.Button label="Cancel" onPress={() => this.handleCancel(e.ans)} />
         <Dialog.Button label="Save" onPress={() => this.handleSave(e.idx, e.ans)} />

       </Dialog.Container>
Sign up to request clarification or add additional context in comments.

2 Comments

there is some empty space between the "Dialog.Input" and buttons, how can i remove that ? @Komal
your answer was very helpful and was almost right but i have managed to do it with "contentStyle" prop. I am posting my solution too
1

"contentStyle" helped me in resolving the issue. My code is:

<Dialog.Container visible={this.state.dialogVisible} contentStyle={{height: 300, width: 300, paddingBottom: 105}}>

    <Dialog.Title>Edit Your Note</Dialog.Title>

    <Dialog.Input paddingHorizontal = "0%" height = "100%" width="100%" multiline={true} onChangeText={(nm) => 
         this.setState({ newNote: nm })}
            value={this.state.newNote}></Dialog.Input>

    <Dialog.Button label="Cancel" onPress={() => this.handleCancel(e.ans)} />
    <Dialog.Button label="Save" onPress={() => this.handleSave(e.idx, e.ans)} />

</Dialog.Container>

Now, view is:

enter image description here

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.