Comments (3)
If you use ToogleButton
without using a ToogleGroup
, then pressed
is respected. This is because ToogleGroup
is testing the selectedName
against the child pressed
prop :
const childrenWithProps = React.Children.map(children, (child) => {
// pass the press state through to child components
return React.cloneElement(child, {
pressed: this.state.selectedName === child.props.name
});
});
Check here for an example --> https://codesandbox.io/s/react-geo-pressed-forked-8nn45?file=/index.js
from react-geo.
Maybe pressed could be calculated like this:
this.stat.selectedName === undefined ? child.props.pressed : this.state.selectedName === child.props.name
But then selectedName would need to get updated after and this would allow multiple buttons to be pressed at once.
The current behaviour is definitely easier, but if it should stay this way it would be nice if the documentation could be updated.
from react-geo.
I agree on updating the Docs, it makes sense to have the group control the button that is pressed, but this is not at all clear
from react-geo.
Related Issues (20)
- UseMap issue HOT 1
- Unable to use this component in a Nextjs app HOT 1
- Unable to import CSS from node_modules HOT 1
- incorrect use of protected openlayers method getAttributions HOT 2
- LayerTree does not need to store LayerTreeNode in the state
- Use react testing library instead of enzyme HOT 1
- Docs not updated on gh-pages branch HOT 4
- Add geodesic option on measure button tool HOT 1
- Panel component breaks when given width and height HOT 1
- Usage with Vite HOT 3
- [Bug]: Incorrect import Paths in Documentation
- [Feature]: Replace unmaintained Semantic Pull Requests GitHub App with Husky :service_dog:
- Update WfsSearch documentation. HOT 2
- [Feature]: Move functionality unrelated to react to better suited libraries HOT 1
- [Question]: OpenLayers 7 HOT 4
- [Bug]: 'MapComponent' cannot be used as a JSX component. HOT 6
- [Bug]: In readme, the examples and tutorial links are broken. HOT 2
- [Bug]: CopyButton animation is broken
- [Bug]: Conflicting antd version requirements between react-geo and geostyler HOT 1
- [Fix]: code smells
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-geo.