[refactor] Make react native usable#883
Conversation
Introduces new type definitions for RouteProvider to accommodate both well-known and custom providers. Adds a `withJsonOptions` helper function to easily configure well-known providers with additional JSON options. This change aligns the RouteProvider structure with conventions used in other platforms and bindings.
This commit introduces a "recenter" button to the `MapControls` component, allowing users to recenter the map. It also adds a `cameraMode` prop to `MapControls` and `NavigationMapViewCamera` to manage different camera behaviors: 'following', 'overview', and 'detached'. The `NavigationView` component now uses this `cameraMode` to conditionally render the recenter button and control the behavior of the map camera. The `handleRoutePress` function has been updated to switch to 'overview' mode when showing the route bounds and to 'following' mode when already in 'overview'. The `handleCameraChanged` callback is added to detect when the user manually interacts with the map and switches the `cameraMode` to 'detached'. Additionally, this commit refactors the `useMemo` hooks in `NavigationView` and `Index.tsx` to use plain objects for configuration, improving readability and potentially performance. The `console.log` statement for route debugging in `Index.tsx` has been removed.
the components more composable and less reliant on prop drilling
fix: auto-complete-search filtering fix: dynamic layout for landscape
This commit introduces several refactors to improve the robustness and
flexibility of the `LocationProvider` and `FerrostarCore` components.
Key changes include:
- **`LocationProvider` Interface:**
- Renamed `LocationProviderInterface` to `LocationProvider`.
- Renamed `LocationUpdateListener` to `LocationObserver`.
- Added `onLocationError` to `LocationObserver` for better error
handling.
- Introduced `LocationSnapshot` to represent the current location
and heading.
- Introduced `LocationSubscription` for managing listener
subscriptions.
- Modified `ManualLocationProvider` to adhere to the new
`LocationProvider` interface, using `observers` instead of
`listeners`.
- Added `getSnapshot()` to `ManualLocationProvider`.
- **`FerrostarCore` Enhancements:**
- Updated `FerrostarCore` to work with the new `LocationProvider`
interface.
- Implemented `connectLocationProvider` to correctly subscribe and
unsubscribe from location providers.
- Improved state management and listener notification logic.
- Added tests for `ManualLocationProvider` and
`SimulatedLocationProvider` to ensure correct observer management.
- Enhanced `FerrostarCore` tests to cover various scenarios,
including provider changes, subscription cleanup, and state
updates.
- Added `_lastHeading` to `NavigationUiState` and updated
`useNavigationState` to include heading information.
- **Testing and Configuration:**
- Migrated testing from Jest to Vitest for improved performance and
features.
- Added `vitest.config.ts` for Vitest configuration.
- Updated `package.json` to reflect the change to Vitest.
- Adjusted `tsconfig.base.json` for better type checking across the
monorepo.
- Introduced aliases for `react` and `react-test-renderer` in Vitest
config to ensure proper resolution within the monorepo.
- **Documentation:**
- Updated type definitions and comments to reflect the changes.
These changes aim to provide a more robust and maintainable location
tracking system within Ferrostar, along with improved testing
infrastructure.
|
I have mention the issues with the binding generation upstream to the uniffi-bindgen-react-native repo. Encase they would like to fix them on that end. Currently I have just fixed them to work for the react native side but I don't know if the changes will effect the android or ios side yet. Here are the two issues if anyone is interested. |
|
Here is the PR for the delete related reserved word issue, we found out it was actually the C++ template generator that was the source of the issue. There was no reserved word checking on the C++ side at all. This PR once merged should fix that issue: jhugman/uniffi-bindgen-react-native#389 |
windows build fix for cmake
|
I've dug some more into jhugman/uniffi-bindgen-react-native#388 and have found out this has been fix in a recent PR that hasn't been included in a release yet. So it looks like we should be all good to go with the initial release of this very soon. |
This is a complete upgrade of the existing react native ferrostar build. Things this PR does is improve the state management and DX of all the components across the UI. This also adds quite a few of the missing features that are lacking compared to the android and ios versions.
This PR fixes the following issue tickets.
Currently there are a few things that aren't adding in yet. These aren't blockers for me at least as I don't use these in our production app.