Comments (2)
I think I know a simpler solution to this. Just use a static breakpoints
variable that gets mutated in render code of the provider (if it's in your theme
.) This way we can access the static variable globally. It's important that this doesn't change on the fly, but I don't see why anyone would change their breakpoints, so that should work.
// breakpoints.ts
export let breakpoints = [...default ones here]
export const editBreakpoints = (newBreakpoints) => (breakpoints = newBreakpoints)
// in DripsyProvider's render
if ('breakpoints' in theme && theme.breakpoints !== breakpoints) {
editBreakpoints(theme.breakpoints)
}
The provider code should run before any other dripsy components or functions, so that should suffice.
from dripsy.
Okay, I think I thought of a simpler solution. At the root of your app, just do this, before importing any Dripsy code:
// App.js
import { setBreakpoints } from 'dripsy'
setBreakpoints([400, 792, 968, 1200]) // replace with your custom breakpoints
import { DripsyProvider } from 'dripsy'
Please let me know if this works if you come across it! I can't guarantee it will, since I'm not fully sure what order the breakpoints on web get created in with fresnel. It's possible it won't, but we'll see. This is currently an experimental feature.
from dripsy.
Related Issues (20)
- ☂️ TypeScript 5 + Intellisense HOT 3
- can use Dripsy with expo-router ? HOT 1
- Styled function Autocomplete don't work HOT 8
- Basic usage of variants broken? HOT 31
- drispy/gradient path doesn't match entrypoint HOT 9
- Nested color path not working linearGradient theme HOT 4
- Fatal error on app launch in 4.1.0 HOT 9
- Missing property shadowOffset HOT 7
- `4.3.4` is not released
- Wrong type for `variant` on `TextInput` HOT 3
- Incompatibility with `[email protected]` HOT 18
- Unable to resolve "stable-hash" from "node_modules\dripsy\build\core\use-sx.js" HOT 5
- [$250 bounty] Types breaking with TS 5.1+ ✅ HOT 16
- example with expo router? HOT 2
- Default Style Replacing Custom `sx` Style Props HOT 7
- Nested texts don't seem to inherit parent styles HOT 6
- how to run with jest HOT 2
- [Typescript] how to type a strict color value ? HOT 2
- autocomplete not working HOT 15
- How performant is Dripsy? HOT 3
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 dripsy.