我正在尝试与namespace Pkg\ExtranetBundle\Form;
use Doctrine\Common\Collections\ArrayCollection;
use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolver;
use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Symfony\Bridge\Doctrine\Form\Type\EntityType;
use Symfony\Component\Form\FormEvents;
use Symfony\Component\Form\FormEvent;
use Doctrine\ORM\EntityManager;
class RoleType extends AbstractType
{
/**
* @var EntityManager
*/
protected $em;
/**
* @param FormBuilderInterface $builder
* @param array $options
*/
public function buildForm(FormBuilderInterface $builder, array $options)
{
$this->em = $options['em'];
$builder->addEventListener(FormEvents::PRE_SUBMIT, array($this, 'onPreSubmit'));
}
/**
* Listener before normalizing data form
*
* @param FormEvent $event
*/
public function onPreSetData(FormEvent $event)
{
$user = $event->getData();
$accessGroups = $this->em->getRepository('PkgExtranetBundle:AccessGroup')->getSelected($user->getRoles());
$user->setAccessGroups(new ArrayCollection($accessGroups));
$event->setData($user);
$form = $event->getForm();
$form->add('accessGroups', EntityType::class, array(
'class' => 'PkgExtranetBundle:AccessGroup',
'choice_label' => 'name',
'choice_value' => 'role',
'multiple' => true,
'expanded' => false
))
->add('save', SubmitType::class, array('label' => 'registration.submit', 'translation_domain' => 'FOSUserBundle'));
}
/**
* @param OptionsResolver $resolver
*/
public function configureOptions(OptionsResolver $resolver)
{
$resolver->setDefaults(array(
'data_class' => 'Pkg\ExtranetBundle\Entity\User',
'em' => null
));
}
}
页面进行关联。
使用android os settings
转到Phone Dail
是有效的。
Linking
我可以使用Linking.openURL('tel: +959 XXXXXXXX');
与Linking
页面链接android os settings
页面吗?
答案 0 :(得分:13)
Linking.openURL
只能打开格式正确的网址。 android settings没有标准化的网址。您必须编写一些本机代码才能执行此操作,然后构建React Native Module来触发它。
以下是一些Android代码示例:
public void openWifiSettings() {
Intent intent = new Intent(Intent.ACTION_WIFI_SETTINGS);
if (intent.resolveActivity(getPackageManager()) != null) {
startActivity(intent);
}
}