birkir / react-native-carplay

CarPlay with React Native
https://birkir.dev/react-native-carplay/
MIT License
642 stars 107 forks source link

POI example crash the app with error: Unsupported object <CPPointOfInterestTemplate:.... #57

Closed vvusts closed 1 year ago

vvusts commented 3 years ago

Hi,

I am trying to use POI template same as in examples but app crash:

import {
    CarPlay, PointOfInterestTemplate
} from 'react-native-carplay';

const template = new PointOfInterestTemplate({
            title: 'Example',
            items: [
              {
                id: 'test',
                location: { latitude: 64.011, longitude: -21.66 },
                title: 'Testing',
                subtitle: 'foobar',
              },
            ],
          });
CarPlay.setRootTemplate(template, false);

But error that I get is: Screenshot 2021-08-20 at 16 11 34

If this is not possible I tried something else:

Screenshot 2021-08-20 at 16 34 29
CarMapView() {
        return (
          <View style={{ flex: 1}} >
            <MapView 
                style={{flex: 1}} 
                provider={PROVIDER_GOOGLE} 
                showsUserLocation={true} 
                followsUserLocation={true}>
                <View style={{backgroundColor: '#f00', padding: 30, marginLeft: 50}}>
                    <TouchableOpacity style={{backgroundColor: '#0ff'}} onPress={() => {CarPlay.pushTemplate(someOtherTemplate);}}>
                        <Text>ITEM A</Text>
                    </TouchableOpacity>
                </View>
            </MapView>
          </View>
        );
      }

const mapTemplate = new MapTemplate({
            component: this.CarMapView
          });

CarPlay.setRootTemplate(mapTemplate, false);

but this doesn't catch touch event on button over map. Any idea?

princekurt commented 3 years ago

Regrettably this hasn't been implemented yet. In the code you can see.

# pragma PointOfInterest
-(void)pointOfInterestTemplate:(CPPointOfInterestTemplate *)pointOfInterestTemplate didChangeMapRegion:(MKCoordinateRegion)region {
    // noop
}
birkir commented 1 year ago

Supported in 2.3.0

Technickster commented 1 year ago

issue is still there in 2.3.0, The supported events needed "didChangeMapRegion" at the top of the class

birkir commented 12 months ago

Yeah we need a MKCoordinateRegion to json converter so we can support the event.

The original issue is resolved however, please create a new issue for missing events (or PR)

ElangoPrince commented 9 months ago

@vvusts Are you able use PointOfInterestTemplate now? Still I'm facing same issue. App getting crash (Closed unfortunately). Can you someone help me how to use this template?

Adding code sample below:

const template = new PointOfInterestTemplate({
            title: 'Example',
            items: [
                {
                    id: 'test',
                    location: { latitude: 64.011, longitude: -21.66 },
                    title: 'Testing',
                    subtitle: 'foobar',
                },
            ],
        });
        CarPlay.pushTemplate(template, false);

@birkir @princekurt FYI

saikiranm33 commented 5 months ago

@birkir Still facing the same issue

saikiranm33 commented 5 months ago

@vvusts hey are u able to get the POI work ?