Comments (9)
@jpamarohorta
Here is a trick you can change the result of calcPosition
using adjustFrame
.
This is a callback after the frame of the dropdown have been calculated and before showing. You will receive a style object as argument with some of the props like width height top left and right. Change them to appropriate values that accord with your requirement and make the new style as the return value of this function.
from react-native-modal-dropdown.
@abdullah-abunada You can override the dropdownStyle.
from react-native-modal-dropdown.
Can you give me example for that, because I overridden it but it still not working.
from react-native-modal-dropdown.
@abdullah-abunada
Sorry if you still have the problem.
You can change the dropdown width like this:
https://github.com/sohobloo/react-native-modal-dropdown/blob/v0.42/example/index.js#L92
from react-native-modal-dropdown.
Yes, I Changed it like that, but I prefer give width 100% for in flex: 1
from react-native-modal-dropdown.
@abdullah-abunada Did you figure this out? Neighter width: 100%
or flex: 1
seems to work.
from react-native-modal-dropdown.
I think the problem with making the dropdown occupy 100% width is in the position.
Using width: Dimensions.get('window').width
in the dropdownStyle
prop makes the dropdown have the given width but still starting at the calculated position. So, it will not occupy the whole screen.
Trying to override the position is not working and I think that happens because of the order of the dropdown styles - style={[styles.dropdown, this.props.dropdownStyle, frameStyle]}
where frameStyle is the calculated position - https://github.com/sohobloo/react-native-modal-dropdown/blob/master/components/ModalDropdown.js#L195.
Anyone has a working solution?
Edit:
I made a fork and switched the order of the dropdown styles - https://github.com/jpamarohorta/react-native-modal-dropdown. Using
{ width: Dimensions.get('window').width, left: 0 }
as dropdownStyle
prop now makes the dropdown full width.
from react-native-modal-dropdown.
Thanks @sohobloo, I didn't notice that could be used for overriding the position/size styles.
Nevertheless, shouldn't the order of the dropdown styles array be changed?
from react-native-modal-dropdown.
Try this https://github.com/Kishanjvaghela/react-native-modal-dropdown.
Added support for isFullWidth
.
You just need to pass true
.
Simple and Easy :-)
from react-native-modal-dropdown.
Related Issues (20)
- Fork with latest PR's merged HOT 2
- is it possible to add the icon on the right of the default value? HOT 4
- Freeze Android HOT 1
- Any possibility to detect onReachEnd options? HOT 1
- This project is working but seems outdated. Which fork to use? HOT 26
- Search bar feature HOT 1
- New Feature : Display selected Item in the Modal as it is in renderItem HOT 2
- a error in the react native 0.63 HOT 11
- Handle Press Error ModalDropdown HOT 1
- Is this library no longer maintained ? HOT 4
- zIndex visibility problem HOT 1
- filter not work without schroll
- Passing props to the rendered FlatList instance
- Getting Scroll to index error HOT 3
- on change of options how can I rerender renderButtonText and empty it's value inside dropdown?
- Error on web HOT 4
- app crashed when press on dropDownmodal HOT 4
- renderButtonComponent or renderRightComponent does not exist in ModalDropdownProps in latest version HOT 1
- How can i use methods show and hidden?
- Z index issue of the dropdown if placed in a view
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-native-modal-dropdown.