Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v.2.0 #42

Merged
merged 145 commits into from
Dec 13, 2023
Merged
Changes from 1 commit
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
6d12ad7
chore: improve CI action, and mention about version 2.0
jpudysz Oct 18, 2023
648673a
fix: yarn.lock
jpudysz Oct 18, 2023
824a09f
fix: flatten preset name
jpudysz Oct 18, 2023
ad08e78
fix: changelog config
jpudysz Oct 18, 2023
6502c63
chore: downgrade the version
jpudysz Oct 18, 2023
2532464
chore: release 2.0.0-alpha.1
jpudysz Oct 18, 2023
f79b601
chore: add code coverage
jpudysz Oct 18, 2023
9cb8664
feat: add static generation for breakpoints
jpudysz Oct 19, 2023
3478485
feat: register theme statically
jpudysz Oct 19, 2023
3892f67
feat: init cxx with jsi
jpudysz Oct 28, 2023
6e9990a
chore: merge cxx with 2.0
jpudysz Oct 28, 2023
5a10218
feat: add native event listeners
jpudysz Oct 28, 2023
395b7c1
feat: add new apis to cxx
jpudysz Oct 31, 2023
4f3ca49
Merge branch 'main' into 2.0
jpudysz Oct 31, 2023
6186559
feat: structure responsibilities
jpudysz Oct 31, 2023
571331b
feat: simplify typescript types
jpudysz Nov 1, 2023
c5819c5
chore: remove ts-ignore, add todo for jsi
jpudysz Nov 1, 2023
d4ed92b
Merge branch 'main' into 2.0
jpudysz Nov 1, 2023
a28e0da
feat: add HostObject for Unistyles
jpudysz Nov 1, 2023
ecb8039
feat: add HostObject for Unistyles
jpudysz Nov 1, 2023
4afc32e
feat: trigger events for initial breakpoint and theme changed
jpudysz Nov 1, 2023
941d7ae
feat: notify on breakpoint change
jpudysz Nov 2, 2023
871d282
chore: release 2.0.0-alpha.2
jpudysz Nov 2, 2023
95ebe9a
feat: add dynamic width and height to runtime
jpudysz Nov 2, 2023
c6bd0c9
feat: add logic to automatically select themes
jpudysz Nov 2, 2023
a9d7118
feat: notify C++ on appearance change
jpudysz Nov 3, 2023
83579f0
feat: adaptive themes
jpudysz Nov 3, 2023
431bad5
fix: yarn.lock
jpudysz Nov 3, 2023
b6d9bbb
chore: release 2.0.0-alpha.3
jpudysz Nov 3, 2023
712313a
feat: refactor ios/cxx codebase
jpudysz Nov 4, 2023
f177cdb
feat: create core for examples
jpudysz Nov 4, 2023
0cee3c8
chore: switch useRef to useMemo
jpudysz Nov 4, 2023
b49014e
feat: add demo for adaptive mode
jpudysz Nov 4, 2023
e0f7c58
feat: add demo for multuple themes
jpudysz Nov 4, 2023
9e531f6
chore: cast to number as breakpoints at this point are mandatory
jpudysz Nov 4, 2023
bd93bf2
Merge branch 'main' into 2.0
jpudysz Nov 6, 2023
b7093cf
chore: merge main
jpudysz Nov 6, 2023
98063e8
feat: add errors for invalid params for themes and breakpoints
jpudysz Nov 6, 2023
78b3f3a
chore: release 2.0.0-alpha.4
jpudysz Nov 6, 2023
bc74484
feat: add support for pixel based media queries ios
jpudysz Nov 7, 2023
2b3ede7
feat: implement orientations for mobile, add demo
jpudysz Nov 7, 2023
6fbd50e
feat: add support for open and closed ranges
jpudysz Nov 7, 2023
296e184
chore: release 2.0.0-alpha.5
jpudysz Nov 7, 2023
2d37841
feat: rewrite media queries engine
jpudysz Nov 8, 2023
203cd3e
feat: move some logic to unistyles engine
jpudysz Nov 9, 2023
6a50ae2
Merge branch 'main' into 2.0
jpudysz Nov 9, 2023
d370d40
chore: merge main with platform colors
jpudysz Nov 10, 2023
257b1a0
chore: specify files for v.2.0
jpudysz Nov 14, 2023
0ef3e2c
chore: release 2.0.0-alpha.6
jpudysz Nov 14, 2023
0cc97c3
feat: add mq util
jpudysz Nov 14, 2023
c0d81ca
chore: cast useStates to get the theme type
jpudysz Nov 14, 2023
076c0e8
chore: release 2.0.0-alpha.7
jpudysz Nov 14, 2023
e2554b8
feat: rewrite media queries
jpudysz Nov 14, 2023
511a2f7
feat: restructure the codebase
jpudysz Nov 15, 2023
db12e00
chore: release 2.0.0-alpha.8
jpudysz Nov 15, 2023
de32ed1
fix: hot reload
jpudysz Nov 15, 2023
04e4f37
chore: reduce the number of emitted events, resolve issue with mq
jpudysz Nov 15, 2023
8b4798f
chore: release 2.0.0-alpha.9
jpudysz Nov 15, 2023
f8ef222
chore: start working on new docs home page
Brentlok Nov 16, 2023
87039aa
feat: add support for variants
jpudysz Nov 16, 2023
2bcd48f
chore: release 2.0.0-alpha.10
jpudysz Nov 16, 2023
9c3050d
chore: finish landing page on desktop
Brentlok Nov 16, 2023
56bd035
chore: animate hero section
Brentlok Nov 16, 2023
0b6f414
feat: improve variants
jpudysz Nov 17, 2023
feebcf5
chore: release 2.0.0-alpha.11
jpudysz Nov 17, 2023
6cd23d7
feat: add support for plugins
jpudysz Nov 17, 2023
4d8d27b
feat: improve runtime plugins
jpudysz Nov 17, 2023
6cc3123
feat: cleanup breakpoints code, add tests
jpudysz Nov 18, 2023
e60cff3
feat: restore all old tests
jpudysz Nov 18, 2023
221fdb1
feat: add demo with high contrast plugin
jpudysz Nov 18, 2023
a7bfe78
feat: add option to register initialTheme during registry, change api…
jpudysz Nov 18, 2023
3067ab3
feat: finalize core API
jpudysz Nov 18, 2023
e1e7583
chore: release 2.0.0-alpha.12
jpudysz Nov 18, 2023
ade1a01
feat: add runtime demo
jpudysz Nov 19, 2023
9076065
feat: add demo with runtime stylesheet
jpudysz Nov 19, 2023
3d50b76
feat: add demo with default variants
jpudysz Nov 19, 2023
6d2a686
chore: release 2.0.0-alpha.13
jpudysz Nov 19, 2023
89ed18c
feat: improve performance
jpudysz Nov 19, 2023
8954157
chore: fix type import
jpudysz Nov 19, 2023
75434b1
chore: release 2.0.0-alpha.14
jpudysz Nov 19, 2023
f55796c
feat: add first benchmark
jpudysz Nov 19, 2023
8365ec8
chore: add colors based on ms
jpudysz Nov 19, 2023
9a2bb0a
chore: keep visuals
jpudysz Nov 19, 2023
76fa2b4
feat: add variance to tests
jpudysz Nov 20, 2023
485bab4
feat: add better benchmarks
jpudysz Nov 20, 2023
955dd21
feat: finalize benchamrks
jpudysz Nov 20, 2023
51b2801
feat: finalize benchmarks
jpudysz Nov 20, 2023
f02f050
chore: animate unicorn in loop
Brentlok Nov 21, 2023
60ee615
chore: add carousel to features on mobile
Brentlok Nov 21, 2023
0db6bbe
feat: rewrite the typescript types
jpudysz Nov 24, 2023
1e101db
feat: improve variants, add new demos
jpudysz Nov 24, 2023
c27a274
feat: finish list of demos
jpudysz Nov 24, 2023
31d3d83
chore: bump deps
jpudysz Nov 24, 2023
ed0eca8
chore: release 2.0.0-alpha.15
jpudysz Nov 24, 2023
86dafe7
feat: add new benchmarks
jpudysz Nov 24, 2023
55c5581
feat: rewrite media queries to support ts above 5.3
jpudysz Nov 25, 2023
80e7ca4
chore: release 2.0.0-alpha.16
jpudysz Nov 25, 2023
e3a6a75
chore: update use styles
jpudysz Nov 25, 2023
89ebb03
chore: improve erorr messages, restrict available methods for registry
jpudysz Nov 25, 2023
3245268
chore: release 2.0.0-alpha.17
jpudysz Nov 25, 2023
bc120b4
chore: change cxx errors
jpudysz Nov 25, 2023
3bc011b
chore: mobile view
Brentlok Nov 28, 2023
35dde03
chore: final touches
Brentlok Nov 28, 2023
701bb9b
chore: feature icons and descriptions
Brentlok Nov 29, 2023
acd24e0
feat: performance improvements
jpudysz Nov 29, 2023
1c0c6eb
chore: release 2.0.0-alpha.18
jpudysz Nov 29, 2023
4239ed0
feat: add android module with base setup
jpudysz Nov 29, 2023
0ba9df3
feat: add suport for android with jni
jpudysz Nov 30, 2023
4ac73f6
chore: change pre release level
jpudysz Nov 30, 2023
78e6f8f
chore: release 2.0.0-beta.1
jpudysz Nov 30, 2023
e36b606
feat: add web bridge
jpudysz Dec 1, 2023
a2fc8b3
feat: add full web support
jpudysz Dec 1, 2023
b7feb00
chore: release 2.0.0-beta.2
jpudysz Dec 1, 2023
a1b564b
feat: media queries for web
jpudysz Dec 2, 2023
3eb86fd
chore: release 2.0.0-beta.3
jpudysz Dec 2, 2023
51642a3
Fix default styles when selected variant has no styles
sharifhh Dec 3, 2023
686f7fa
remove consts and add comments
sharifhh Dec 3, 2023
a8a2e8c
Merge pull request #74 from sharifhh/patch-1
jpudysz Dec 3, 2023
34d216e
chore: fix lint issue
jpudysz Dec 3, 2023
1df0731
feat: add support for SSR
jpudysz Dec 4, 2023
6476dd1
chore: release 2.0.0-beta.4
jpudysz Dec 4, 2023
8e61a1e
feat: fix cmake paths
jpudysz Dec 4, 2023
e2eb9b6
chore: release 2.0.0-beta.5
jpudysz Dec 4, 2023
34f4f0c
fix: android native destroy
jpudysz Dec 4, 2023
27148fa
chore: release 2.0.0-beta.6
jpudysz Dec 4, 2023
8ccf68e
chore: add rainbow animation
Brentlok Dec 5, 2023
ba02cc9
fix: android build in react native 0.73+
migueldaipre Dec 5, 2023
6b2153b
chore: hamburger menu
Brentlok Dec 6, 2023
6caae1a
chore: hide menu on resoultion change
Brentlok Dec 6, 2023
8114213
Merge pull request #77 from Brentlok/new-docs
jpudysz Dec 6, 2023
a46b04f
Merge pull request #76 from migueldaipre/fix/build-android-0.73
jpudysz Dec 6, 2023
c4ac837
feat: add support for new architecture
jpudysz Dec 6, 2023
679f7d7
chore: release 2.0.0-beta.7
jpudysz Dec 6, 2023
b39f810
feat: add expressive code plugin
jpudysz Dec 6, 2023
e71ad74
feat: first batch of docs
jpudysz Dec 9, 2023
029a801
feat: next batch of docs
jpudysz Dec 10, 2023
1113bad
feat: add guide for sponsors and showcases
jpudysz Dec 10, 2023
3bb7c63
feat: change readme add new charts
jpudysz Dec 11, 2023
cd59ade
feat: replace all todos and change docs color
jpudysz Dec 11, 2023
26b1a7b
feat: add new documentation pages
jpudysz Dec 11, 2023
16f4d3b
feat: finish the docs
jpudysz Dec 12, 2023
5a58a77
feat: polish the docs
jpudysz Dec 12, 2023
94108d4
feat: update opengraph image
jpudysz Dec 12, 2023
83e6ce6
chore: point links to production
jpudysz Dec 12, 2023
ea83471
feat: add jsdoc metadata
jpudysz Dec 13, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
chore: cast useStates to get the theme type
jpudysz committed Nov 14, 2023
commit c0d81cad60c3e6f46f67fc466b292bf96af70dde
15 changes: 11 additions & 4 deletions src/useUnistyles.ts
Original file line number Diff line number Diff line change
@@ -1,16 +1,23 @@
import { NativeEventEmitter, NativeModules } from 'react-native'
import { useEffect, useState } from 'react'
import type { UnistylesThemeEvent, UnistylesMobileLayoutEvent, UnistylesEvents } from './types'
import type {
UnistylesThemeEvent,
UnistylesMobileLayoutEvent,
UnistylesEvents,
ScreenSize,
UnistylesTheme
} from './types'
import { CxxUnistylesEventTypes, ScreenOrientation } from './types'
import { unistyles } from './Unistyles'
import type { UnistylesBreakpoints } from './global'

const unistylesEvents = new NativeEventEmitter(NativeModules.Unistyles)

export const useUnistyles = () => {
const [orientation, setOrientation] = useState<ScreenOrientation>(unistyles.runtime.orientation)
const [theme, setTheme] = useState(unistyles.runtime.getTheme(unistyles.runtime.themeName))
const [breakpoint, setBreakpoint] = useState(unistyles.runtime.breakpoint)
const [screenSize, setScreenSize] = useState({
const [theme, setTheme] = useState<UnistylesTheme>(unistyles.runtime.getTheme(unistyles.runtime.themeName))
const [breakpoint, setBreakpoint] = useState<keyof UnistylesBreakpoints>(unistyles.runtime.breakpoint)
const [screenSize, setScreenSize] = useState<ScreenSize>({
width: unistyles.runtime.screen.width,
height: unistyles.runtime.screen.height
})