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

[Bug]: Exception in host function on StyleImport call #3709

Closed
vineyardbovines opened this issue Dec 1, 2024 · 2 comments
Closed

[Bug]: Exception in host function on StyleImport call #3709

vineyardbovines opened this issue Dec 1, 2024 · 2 comments

Comments

@vineyardbovines
Copy link

vineyardbovines commented Dec 1, 2024

Mapbox Implementation

Mapbox

Mapbox Version

11.8.0

React Native Version

0.76.1

Platform

iOS

@rnmapbox/maps version

10.1.33

Standalone component to reproduce

import { StyleSheet } from "react-native";
import Mapbox from "@rnmapbox/maps";

Mapbox.setAccessToken(
	"pk.ey...",
);

export default function App() {
  return (
    <Mapbox.MapView styleURL="mapbox://styles/mapbox/standard">
      <Mapbox.StyleImport
        id="basemap"
        existing
        config={{ lightPreset: "dusk" }}
      />
      <Mapbox.Camera />
    </Mapbox.MapView>
  );
}

Observed behavior and steps to reproduce

CleanShot 2024-12-01 at 16 24 13@2x

CleanShot 2024-12-01 at 16 36 31@2x
CleanShot 2024-12-01 at 16 39 55@2x

On a bare example with StyleImport called, throws a host exception error.

Expected behavior

Should render the map as expected with the dusk preset set

Notes / preliminary analysis

No response

Additional links and references

No response

Copy link

github-actions bot commented Dec 1, 2024

Lint failed 😭

Please fix the errors in your code example - More info.:

error: 'React' must be in scope when using JSX (react/react-in-jsx-scope) at example.jsx:11:5:
   9 | export default function App() {
  10 |   return (
> 11 |     <Mapbox.MapView styleURL="mapbox://styles/mapbox/standard">
     |     ^
  12 |       <Mapbox.StyleImport
  13 |         id="basemap"
  14 |         existing


error: 'React' must be in scope when using JSX (react/react-in-jsx-scope) at example.jsx:12:7:
  10 |   return (
  11 |     <Mapbox.MapView styleURL="mapbox://styles/mapbox/standard">
> 12 |       <Mapbox.StyleImport
     |       ^
  13 |         id="basemap"
  14 |         existing
  15 |         config={{ lightPreset: "dusk" }}


error: 'React' must be in scope when using JSX (react/react-in-jsx-scope) at example.jsx:17:7:
  15 |         config={{ lightPreset: "dusk" }}
  16 |       />
> 17 |       <Mapbox.Camera />
     |       ^
  18 |     </Mapbox.MapView>
  19 |   );
  20 | }


3 errors found.```

@vineyardbovines
Copy link
Author

Repro: https://github.com/vineyardbovines/rnmapbox-styleimport-bug

  1. Add secret key to app.json
  2. Add public key to App.tsx
  3. npx expo prebuild -p ios
  4. Ensure podfile has secret key
  5. Run the workspace in xcode

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant